Skip to content

Commit

Permalink
Post review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-sekara committed Nov 18, 2024
1 parent 16f63f6 commit 33f6047
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 2 additions & 0 deletions deployment/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rpc"
chain_selectors "github.com/smartcontractkit/chain-selectors"
"github.com/smartcontractkit/chainlink-testing-framework/lib/docker/test_env"
types2 "github.com/smartcontractkit/libocr/offchainreporting2/types"
types3 "github.com/smartcontractkit/libocr/offchainreporting2plus/types"
"google.golang.org/grpc"
Expand Down Expand Up @@ -75,6 +76,7 @@ type Environment struct {
Chains map[uint64]Chain
NodeIDs []string
Offchain OffchainClient
MockAdapter *test_env.Killgrave
}

func NewEnvironment(
Expand Down
3 changes: 2 additions & 1 deletion integration-tests/ccip-tests/testsetups/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ func NewLocalDevEnvironment(
testEnv, cfg)
require.NoError(t, err)
e, don, err := devenv.NewEnvironment(ctx, lggr, *envConfig)

require.NoError(t, err)
require.NotNil(t, e)
e.ExistingAddresses = ab
e.MockAdapter = testEnv.MockAdapter

envNodes, err := deployment.NodeInfo(e.NodeIDs, e.Offchain)
require.NoError(t, err)
Expand Down Expand Up @@ -301,6 +301,7 @@ func CreateDockerEnv(t *testing.T) (
builder := test_env.NewCLTestEnvBuilder().
WithTestConfig(&cfg).
WithTestInstance(t).
WithMockAdapter().
WithJobDistributor(cfg.CCIP.JobDistributorConfig).
WithStandardCleanup()

Expand Down
23 changes: 17 additions & 6 deletions integration-tests/smoke/ccip_usdc_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package smoke

import (
"github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/actions"
"github.com/smartcontractkit/chainlink/integration-tests/ccip-tests/testsetups"
"golang.org/x/exp/maps"
"math/big"
"net/http"
Expand Down Expand Up @@ -30,7 +32,19 @@ import (
func TestUSDCTokenTransfer(t *testing.T) {
lggr := logger.TestLogger(t)
ctx := ccdeploy.Context(t)
tenv := ccdeploy.NewMemoryEnvironment(t, lggr, 2, 4, ccdeploy.MockLinkPrice, ccdeploy.MockWethPrice)
tenv, cluster, _ := testsetups.NewLocalDevEnvironmentWithDefaultPrice(t, lggr)

var endpoint string
// When inmemory env then spin up in memory mock server
if cluster == nil {
server := mockAttestationResponse()
defer server.Close()
endpoint = server.URL
} else {
err := actions.SetMockServerWithUSDCAttestation(tenv.Env.MockAdapter, nil)
require.NoError(t, err)
endpoint = tenv.Env.MockAdapter.InternalEndpoint
}

e := tenv.Env
state, err := ccdeploy.LoadOnchainState(e)
Expand All @@ -40,9 +54,6 @@ func TestUSDCTokenTransfer(t *testing.T) {
sourceChain := allChainSelectors[0]
destChain := allChainSelectors[1]

server := mockAttestationResponse()
defer server.Close()

feeds := state.Chains[tenv.FeedChainSel].USDFeeds
tokenConfig := ccdeploy.NewTokenConfig()
tokenConfig.UpsertTokenInfo(ccdeploy.LinkSymbol,
Expand Down Expand Up @@ -70,7 +81,7 @@ func TestUSDCTokenTransfer(t *testing.T) {
USDCConfig: ccdeploy.USDCConfig{
Enabled: true,
USDCAttestationConfig: ccdeploy.USDCAttestationConfig{
API: server.URL,
API: endpoint,
APITimeout: commonconfig.MustNewDuration(time.Second),
APIInterval: commonconfig.MustNewDuration(500 * time.Millisecond),
},
Expand Down Expand Up @@ -216,7 +227,7 @@ func mintAndAllow(
}
}

// transferAndWaitForSuccess sends a message from sourceChain to destChain and waits for it to be executed (commited + executed)
// transferAndWaitForSuccess sends a message from sourceChain to destChain and waits for it to be executed
func transferAndWaitForSuccess(
t *testing.T,
env deployment.Environment,
Expand Down

0 comments on commit 33f6047

Please sign in to comment.