diff --git a/integration-tests/ccip-tests/contracts/laneconfig/parse_contracts.go b/integration-tests/ccip-tests/contracts/laneconfig/parse_contracts.go index 73a80573bc..11092a2a88 100644 --- a/integration-tests/ccip-tests/contracts/laneconfig/parse_contracts.go +++ b/integration-tests/ccip-tests/contracts/laneconfig/parse_contracts.go @@ -4,7 +4,9 @@ import ( _ "embed" "encoding/json" "errors" + "fmt" "os" + "path/filepath" "sync" "github.com/ethereum/go-ethereum/common" @@ -202,6 +204,16 @@ func WriteLanesToJSON(path string, lanes *Lanes) error { if err != nil { return err } + // Get the directory part of the file path. + dir := filepath.Dir(path) + // Check if the directory exists. + if _, err := os.Stat(dir); os.IsNotExist(err) { + // The directory does not exist, create it. + if err := os.MkdirAll(dir, 0755); err != nil { + return fmt.Errorf("failed to create directory: %w", err) + } + } + f, err := os.Create(path) if err != nil { return err diff --git a/integration-tests/ccip-tests/testsetups/ccip.go b/integration-tests/ccip-tests/testsetups/ccip.go index 2025db2f58..5d5a58533e 100644 --- a/integration-tests/ccip-tests/testsetups/ccip.go +++ b/integration-tests/ccip-tests/testsetups/ccip.go @@ -707,7 +707,8 @@ func CCIPDefaultTestSetUp( var ( err error ) - filename := fmt.Sprintf("./tmp_%s.json", strings.ReplaceAll(t.Name(), "/", "_")) + reportPath := "tmp_laneconfig" + filename := fmt.Sprintf("./%s/tmp_%s.json", reportPath, strings.ReplaceAll(t.Name(), "/", "_")) var transferAmounts []*big.Int if testConfig.TestGroupInput.MsgType == actions.TokenTransfer { for i := 0; i < testConfig.TestGroupInput.NoOfTokensInMsg; i++ {