diff --git a/tests/e2e/common/test_common.go b/tests/e2e/common/test_common.go index fd13f30bd..675943d8a 100644 --- a/tests/e2e/common/test_common.go +++ b/tests/e2e/common/test_common.go @@ -20,7 +20,6 @@ import ( ) const ( - SourcePath = "/variable" ContractsStateFile = "contracts-chaos-state.json" NewRoundCheckTimeout = 90 * time.Second NewRoundCheckPollInterval = 1 * time.Second @@ -240,7 +239,7 @@ func (m *OCRv2TestState) createJobs() { } sourceValueBridge := client.BridgeTypeAttributes{ Name: "variable", - URL: fmt.Sprintf("%s/variable", m.MockServer.Config.ClusterURL), + URL: fmt.Sprintf("%s/node%d", m.MockServer.Config.ClusterURL, nIdx), RequestData: "{}", } observationSource := client.ObservationSourceSpecBridge(sourceValueBridge) @@ -274,9 +273,24 @@ func (m *OCRv2TestState) createJobs() { } } +func (m *OCRv2TestState) SetAllAdapterResponsesToTheSameValue(response int) { + for i := range m.ChainlinkNodes { + path := fmt.Sprintf("/node%d", i) + m.err = m.MockServer.SetValuePath(path, response) + Expect(m.err).ShouldNot(HaveOccurred()) + } +} + +func (m *OCRv2TestState) SetAllAdapterResponsesToDifferentValues(responses []int) { + Expect(len(responses)).Should(BeNumerically("==", len(m.ChainlinkNodes))) + for i := range m.ChainlinkNodes { + m.err = m.MockServer.SetValuePath(fmt.Sprintf("/node%d", i), responses[i]) + Expect(m.err).ShouldNot(HaveOccurred()) + } +} + func (m *OCRv2TestState) CreateJobs() { - m.err = m.MockServer.SetValuePath("/variable", 5) - Expect(m.err).ShouldNot(HaveOccurred()) + m.SetAllAdapterResponsesToTheSameValue(5) m.err = m.MockServer.SetValuePath("/juels", 1) Expect(m.err).ShouldNot(HaveOccurred()) m.createJobs() @@ -285,9 +299,9 @@ func (m *OCRv2TestState) CreateJobs() { func (m *OCRv2TestState) ImitateSource(changeInterval time.Duration, min int, max int) { go func() { for { - _ = m.MockServer.SetValuePath(SourcePath, min) + m.SetAllAdapterResponsesToTheSameValue(min) time.Sleep(changeInterval) - _ = m.MockServer.SetValuePath(SourcePath, max) + m.SetAllAdapterResponsesToTheSameValue(max) time.Sleep(changeInterval) } }() diff --git a/tests/e2e/smoke/ocr2_test.go b/tests/e2e/smoke/ocr2_test.go index 64a2cba6d..9a1dd7e8b 100644 --- a/tests/e2e/smoke/ocr2_test.go +++ b/tests/e2e/smoke/ocr2_test.go @@ -1,13 +1,13 @@ package smoke import ( + "github.com/smartcontractkit/integrations-framework/actions" "time" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/rs/zerolog/log" "github.com/smartcontractkit/chainlink-solana/tests/e2e/common" - "github.com/smartcontractkit/integrations-framework/actions" ) var _ = Describe("Solana OCRv2", func() {