From 8ffcd1db83cbc3abfb0eefcd46b15120c6e33270 Mon Sep 17 00:00:00 2001 From: cfal Date: Mon, 7 Aug 2023 18:48:15 +0800 Subject: [PATCH] integration-tests: call CreateJobs, use mock-adapter bridge --- integration-tests/common/client.go | 10 ++++++++-- integration-tests/common/common.go | 5 ++++- integration-tests/ocr2_test.go | 10 ++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/integration-tests/common/client.go b/integration-tests/common/client.go index e5de1059..6c01e1e3 100644 --- a/integration-tests/common/client.go +++ b/integration-tests/common/client.go @@ -87,7 +87,7 @@ func (cc *ChainlinkClient) LoadOCR2Config(proposalId string, accountAddresses [] } // CreateJobsForContract Creates and sets up the boostrap jobs as well as OCR jobs -func (cc *ChainlinkClient) CreateJobsForContract(chainId, p2pPort string, observationSource string, juelsPerFeeCoinSource string, ocrControllerAddress string, accountAddresses []string) error { +func (cc *ChainlinkClient) CreateJobsForContract(chainId, p2pPort, mockUrl string, observationSource string, juelsPerFeeCoinSource string, ocrControllerAddress string, accountAddresses []string) error { // TODO: fix up relay configs // Define node[0] as bootstrap node cc.bootstrapPeers = []client.P2PData{ @@ -129,12 +129,18 @@ func (cc *ChainlinkClient) CreateJobsForContract(chainId, p2pPort string, observ p2pBootstrappers = append(p2pBootstrappers, cc.bootstrapPeers[i].P2PV2Bootstrapper()) } + sourceValueBridge := &client.BridgeTypeAttributes{ + Name: "bridge-mockadapter", + URL: fmt.Sprintf("%s/%s", mockUrl, "five"), + RequestData: "{}", + } + // Setting up job specs for nIdx, n := range cc.ChainlinkNodes { if nIdx == 0 { continue } - _, err := n.CreateBridge(cc.bTypeAttr) + _, err := n.CreateBridge(sourceValueBridge) if err != nil { return err } diff --git a/integration-tests/common/common.go b/integration-tests/common/common.go index 25f425c8..351a76d9 100644 --- a/integration-tests/common/common.go +++ b/integration-tests/common/common.go @@ -49,6 +49,7 @@ type Common struct { NodeCount int TTL time.Duration NodeUrl string + MockUrl string Mnemonic string Account string ObservationSource string @@ -133,6 +134,7 @@ ListenAddresses = ['0.0.0.0:6690'] NodeCount: getNodeCount(), TTL: getTTL(), NodeUrl: nodeUrl, + MockUrl: "http://172.17.0.1:6060", Mnemonic: getEnv("MNEMONIC"), Account: getEnv("ACCOUNT"), ObservationSource: observationSource, @@ -149,7 +151,8 @@ func (c *Common) SetLocalEnvironment() { ChartName: "unused", PodName: "unused", LocalIP: "http://127.0.0.1:6688", - InternalIP: "postgresql://postgres@172.17.0.1:35432/cosmos_test?sslmode=disable", + InternalIP: "http://host.docker.internal:6688", + DBLocalIP: "postgresql://postgres@host.docker.internal:35432/cosmos_test?sslmode=disable", }, } } diff --git a/integration-tests/ocr2_test.go b/integration-tests/ocr2_test.go index 0b58f283..39259f18 100644 --- a/integration-tests/ocr2_test.go +++ b/integration-tests/ocr2_test.go @@ -100,6 +100,16 @@ func TestOCRBasic(t *testing.T) { _, err = cg.ProposeOffchainConfig(string(parsedConfig), ocrAddress) require.NoError(t, err, "Could not propose config details") + p2pPort := "6690" + chainlinkClient.CreateJobsForContract( + commonConfig.ChainId, + p2pPort, + commonConfig.MockUrl, + commonConfig.ObservationSource, + commonConfig.JuelsPerFeeCoinSource, + ocrAddress, + []string{commonConfig.Account}) + //if !testState.Common.Testnet { //testState.Devnet.AutoLoadState(testState.OCR2Client, testState.OCRAddr) //}