Skip to content

Commit

Permalink
WIP: porting over gauntlet commands
Browse files Browse the repository at this point in the history
  • Loading branch information
aalu1418 committed Mar 27, 2024
1 parent b834fe4 commit 837bfdb
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
52 changes: 48 additions & 4 deletions integration-tests/common/test_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,25 @@ func (m *OCRv2TestState) NewSolanaClientSetup(networkSettings *solclient.SolNetw

}

func (m *OCRv2TestState) SetupClients() {
func (m *OCRv2TestState) NewGauntletSetup() (*gauntlet.SolanaGauntlet, error) {
cfg := m.ConfigureGauntlet("this is an testing only secret") // TODO: move secret
g, err := gauntlet.NewSolanaGauntlet(fmt.Sprintf("%s/gauntlet", utils.ProjectRoot))
if err != nil {
return nil, err
}
return g, g.SetupNetwork(cfg)
}

func (m *OCRv2TestState) SetupClients(enableGauntlet bool) {
// setup direct solana API
m.Client, m.err = m.NewSolanaClientSetup(m.Client.Config)
require.NoError(m.T, m.err)
require.NoError(m.T, m.err, "error setting up sol client")

// TODO: setup gauntlet
// setup gauntlet
if enableGauntlet {
m.Gauntlet, m.err = m.NewGauntletSetup()
require.NoError(m.T, m.err, "error setting up gauntlet")
}

if m.Common.IsK8s {
m.ChainlinkNodesK8s, m.err = client.ConnectChainlinkNodes(m.Common.Env)
Expand Down Expand Up @@ -272,8 +285,11 @@ func (m *OCRv2TestState) DeployContracts(contractsDir string) {
g := errgroup.Group{}
for i := 0; i < len(m.ContractsNodeSetup); i++ {
i := i
// TODO: boolean to handle deploying with gauntlet
g.Go(func() error {
// use gauntlet if it exists
if m.Gauntlet != nil {
return m.DeployFeedWithGauntlet(i)
}
return m.DeployFeedWithSolClient(i)
})
}
Expand All @@ -284,6 +300,34 @@ func (m *OCRv2TestState) DeployContracts(contractsDir string) {
}
}

func (m *OCRv2TestState) DeployFeedWithGauntlet(i int) error {
_, err := m.Gauntlet.DeployOCR2()
require.NoError(m.T, err, "Error deploying OCR")

var nodeCount int
if m.Common.IsK8s {
nodeCount = len(m.ContractsNodeSetup[i].NodesK8s)
} else {
nodeCount = len(m.ContractsNodeSetup[i].Nodes)
}
ocConfig, err := OffChainConfigParamsFromNodes(nodeCount, m.ContractsNodeSetup[i].NodeKeysBundle)
require.NoError(m.T, err)

// TODO: use gauntlet
// err = ocr2.Configure(ocConfig)
// require.NoError(m.T, err)
// m.Mu.Lock()
// m.Contracts = append(m.Contracts, Contracts{
// BAC: bac,
// RAC: rac,
// OCR2: ocr2,
// Store: store,
// StoreAuth: storeAuth,
// })
// m.Mu.Unlock()
return nil
}

func (m *OCRv2TestState) DeployFeedWithSolClient(i int) error {
cd, err := solclient.NewContractDeployer(m.Client, m.Client.LinkToken)
require.NoError(m.T, err)
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func TestSolanaOCRV2Smoke(t *testing.T) {
name string
env map[string]string
}{
{name: "embeded"},
{name: "embedded"},
{name: "plugins", env: map[string]string{
"CL_MEDIAN_CMD": "chainlink-feeds",
"CL_SOLANA_CMD": "chainlink-solana",
Expand Down

0 comments on commit 837bfdb

Please sign in to comment.