Skip to content

Commit

Permalink
add support for median plugin in OCR2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofel committed May 17, 2024
1 parent c735365 commit 6448498
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ type ocr2test struct {
chainReaderAndCodec bool
}

func defaultTestData() ocr2test {
return ocr2test{
name: "n/a",
env: make(map[string]string),
chainReaderAndCodec: false,
}
}

// Tests a basic OCRv2 median feed
func TestOCRv2Basic(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -70,7 +78,7 @@ func TestOCRv2Request(t *testing.T) {
t.Parallel()
l := logging.GetTestLogger(t)

_, aggregatorContracts, sethClient := prepareORCv2SmokeTestEnv(t, l, 5)
_, aggregatorContracts, sethClient := prepareORCv2SmokeTestEnv(t, defaultTestData(), l, 5)

// Keep the mockserver value the same and continually request new rounds
for round := 2; round <= 4; round++ {
Expand All @@ -92,7 +100,7 @@ func TestOCRv2JobReplacement(t *testing.T) {
t.Parallel()
l := logging.GetTestLogger(t)

env, aggregatorContracts, sethClient := prepareORCv2SmokeTestEnv(t, l, 5)
env, aggregatorContracts, sethClient := prepareORCv2SmokeTestEnv(t, defaultTestData(), l, 5)
nodeClients := env.ClCluster.NodeAPIs()
bootstrapNode, workerNodes := nodeClients[0], nodeClients[1:]

Expand Down Expand Up @@ -128,7 +136,7 @@ func TestOCRv2JobReplacement(t *testing.T) {
)
}

func prepareORCv2SmokeTestEnv(t *testing.T, test ocr2test, l zerolog.Logger, firstRoundResult int) (*test_env.CLClusterTestEnv, []contracts.OffchainAggregatorV2, *seth.Client) {
func prepareORCv2SmokeTestEnv(t *testing.T, testData ocr2test, l zerolog.Logger, firstRoundResult int) (*test_env.CLClusterTestEnv, []contracts.OffchainAggregatorV2, *seth.Client) {
config, err := tc.GetConfig("Smoke", tc.OCR2)
if err != nil {
t.Fatal(err)
Expand All @@ -147,7 +155,7 @@ func prepareORCv2SmokeTestEnv(t *testing.T, test ocr2test, l zerolog.Logger, fir
node.WithP2Pv2(),
node.WithTracing(),
)).
WithCLNodeOptions(test_env.WithNodeEnvVars(test.env)).
WithCLNodeOptions(test_env.WithNodeEnvVars(testData.env)).
WithCLNodes(6).
WithFunding(big.NewFloat(.1)).
WithStandardCleanup().
Expand Down Expand Up @@ -182,7 +190,7 @@ func prepareORCv2SmokeTestEnv(t *testing.T, test ocr2test, l zerolog.Logger, fir
aggregatorContracts, err := actions_seth.DeployOCRv2Contracts(l, sethClient, 1, common.HexToAddress(linkContract.Address()), transmitters, ocrOffchainOptions)
require.NoError(t, err, "Error deploying OCRv2 aggregator contracts")

err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, uint64(sethClient.ChainID), false, false)
err = actions.CreateOCRv2JobsLocal(aggregatorContracts, bootstrapNode, workerNodes, env.MockAdapter, "ocr2", 5, uint64(sethClient.ChainID), false, testData.chainReaderAndCodec)
require.NoError(t, err, "Error creating OCRv2 jobs")

ocrv2Config, err := actions.BuildMedianOCR2ConfigLocal(workerNodes, ocrOffchainOptions)
Expand Down

0 comments on commit 6448498

Please sign in to comment.