Skip to content

Commit

Permalink
integration-tests: call CreateJobs, use mock-adapter bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
cfal committed Aug 7, 2023
1 parent 5877e4b commit 8ffcd1d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
10 changes: 8 additions & 2 deletions integration-tests/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 4 additions & 1 deletion integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Common struct {
NodeCount int
TTL time.Duration
NodeUrl string
MockUrl string
Mnemonic string
Account string
ObservationSource string
Expand Down Expand Up @@ -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,
Expand All @@ -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",
},
}
}
Expand Down
10 changes: 10 additions & 0 deletions integration-tests/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
//}
Expand Down

0 comments on commit 8ffcd1d

Please sign in to comment.