diff --git a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go index 06d5e2b3f66..be4bf09d402 100644 --- a/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go +++ b/core/services/ocr2/plugins/ocr2keeper/integration_21_test.go @@ -40,7 +40,7 @@ import ( registrylogicb21 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_logic_b_wrapper_2_1" registry21 "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/keeper_registry_wrapper_2_1" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/link_token_interface" - "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/log_triggered_feed_lookup_wrapper" + "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/log_triggered_streams_lookup_wrapper" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/log_upkeep_counter_wrapper" "github.com/smartcontractkit/chainlink/v2/core/gethwrappers/generated/mock_v3_aggregator_contract" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" @@ -295,6 +295,7 @@ func TestIntegration_KeeperPluginLogUpkeep_Retry(t *testing.T) { nodes, mercuryServer := setupNodes(t, nodeKeys, registry, backend, registryOwner) const upkeepCount = 10 + const mercuryFailCount = upkeepCount * 3 * 2 // testing with the mercury server involves mocking responses. currently, // there is not a way to connect a mercury call to an upkeep id (though we @@ -313,26 +314,28 @@ func TestIntegration_KeeperPluginLogUpkeep_Retry(t *testing.T) { _ = r.ParseForm() - // TODO: validate request URI t.Logf("MercuryHTTPServe:RequestURI: %s", r.RequestURI) - // TODO: validate form values for key, value := range r.Form { t.Logf("MercuryHTTPServe:FormValue: key: %s; value: %s;", key, value) } - // upkeepCount * 2 should be two rounds of calling the mercury endpoint - if count <= upkeepCount*2 { - // start sending success messages - output := `{"chainlinkBlob":"0x0001c38d71fed6c320b90e84b6f559459814d068e2a1700adc931ca9717d4fe70000000000000000000000000000000000000000000000000000000001a80b52b4bf1233f9cb71144a253a1791b202113c4ab4a92fa1b176d684b4959666ff8200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001004254432d5553442d415242495452554d2d544553544e4554000000000000000000000000000000000000000000000000000000000000000000000000645570be000000000000000000000000000000000000000000000000000002af2b818dc5000000000000000000000000000000000000000000000000000002af2426faf3000000000000000000000000000000000000000000000000000002af32dc209700000000000000000000000000000000000000000000000000000000012130f8df0a9745bb6ad5e2df605e158ba8ad8a33ef8a0acf9851f0f01668a3a3f2b68600000000000000000000000000000000000000000000000000000000012130f60000000000000000000000000000000000000000000000000000000000000002c4a7958dce105089cf5edb68dad7dcfe8618d7784eb397f97d5a5fade78c11a58275aebda478968e545f7e3657aba9dcbe8d44605e4c6fde3e24edd5e22c94270000000000000000000000000000000000000000000000000000000000000002459c12d33986018a8959566d145225f0c4a4e61a9a3f50361ccff397899314f0018162cf10cd89897635a0bb62a822355bd199d09f4abe76e4d05261bb44733d"}` - - w.WriteHeader(http.StatusOK) - _, _ = w.Write([]byte(output)) + // the streams lookup retries against the remote server 3 times before + // returning a result as retryable. + // the simulation here should force the streams lookup process to return + // retryable 2 times. + // the total count of failures should be (upkeepCount * 3 * tryCount) + if count <= mercuryFailCount { + w.WriteHeader(http.StatusNotFound) return } - w.WriteHeader(http.StatusNotFound) + // start sending success messages + output := `{"chainlinkBlob":"0x0001c38d71fed6c320b90e84b6f559459814d068e2a1700adc931ca9717d4fe70000000000000000000000000000000000000000000000000000000001a80b52b4bf1233f9cb71144a253a1791b202113c4ab4a92fa1b176d684b4959666ff8200000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000260000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001004254432d5553442d415242495452554d2d544553544e4554000000000000000000000000000000000000000000000000000000000000000000000000645570be000000000000000000000000000000000000000000000000000002af2b818dc5000000000000000000000000000000000000000000000000000002af2426faf3000000000000000000000000000000000000000000000000000002af32dc209700000000000000000000000000000000000000000000000000000000012130f8df0a9745bb6ad5e2df605e158ba8ad8a33ef8a0acf9851f0f01668a3a3f2b68600000000000000000000000000000000000000000000000000000000012130f60000000000000000000000000000000000000000000000000000000000000002c4a7958dce105089cf5edb68dad7dcfe8618d7784eb397f97d5a5fade78c11a58275aebda478968e545f7e3657aba9dcbe8d44605e4c6fde3e24edd5e22c94270000000000000000000000000000000000000000000000000000000000000002459c12d33986018a8959566d145225f0c4a4e61a9a3f50361ccff397899314f0018162cf10cd89897635a0bb62a822355bd199d09f4abe76e4d05261bb44733d"}` + + w.WriteHeader(http.StatusOK) + _, _ = w.Write([]byte(output)) }) defer mercuryServer.Stop() @@ -781,7 +784,7 @@ type feedLookupUpkeepController struct { count int upkeepIds []*big.Int addresses []common.Address - contracts []*log_triggered_feed_lookup_wrapper.LogTriggeredFeedLookup + contracts []*log_triggered_streams_lookup_wrapper.LogTriggeredStreamsLookup contractsOwner *bind.TransactOpts } @@ -810,11 +813,11 @@ func (c *feedLookupUpkeepController) DeployUpkeeps( count int, ) error { addresses := make([]common.Address, count) - contracts := make([]*log_triggered_feed_lookup_wrapper.LogTriggeredFeedLookup, count) + contracts := make([]*log_triggered_streams_lookup_wrapper.LogTriggeredStreamsLookup, count) // deploy n upkeep contracts for x := 0; x < count; x++ { - addr, _, contract, err := log_triggered_feed_lookup_wrapper.DeployLogTriggeredFeedLookup( + addr, _, contract, err := log_triggered_streams_lookup_wrapper.DeployLogTriggeredStreamsLookup( owner, backend, false, @@ -938,7 +941,7 @@ func (c *feedLookupUpkeepController) VerifyEnv( // call individual contracts to see that they revert for _, contract := range c.contracts { - _, err := contract.CheckLog(c.contractsOwner, log_triggered_feed_lookup_wrapper.Log{ + _, err := contract.CheckLog(c.contractsOwner, log_triggered_streams_lookup_wrapper.Log{ Index: big.NewInt(0), TxIndex: big.NewInt(0), TxHash: common.HexToHash("0x1"),