Skip to content

Commit

Permalink
Merge pull request #179 from smartcontractkit/main-repo-merge
Browse files Browse the repository at this point in the history
Main repo merge
  • Loading branch information
AnieeG authored Oct 2, 2023
2 parents 37b87f0 + 18f1473 commit db1a0d8
Show file tree
Hide file tree
Showing 23 changed files with 199 additions and 179 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ jobs:
# strategy:
# matrix:
# image:
# - name: (base)
# - name: (legacy)
# tag-suffix: ""
# - name: (plugins)
# tag-suffix: -plugins
Expand Down
4 changes: 0 additions & 4 deletions core/services/job/job_orm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1474,7 +1474,6 @@ func Test_FindPipelineRunIDsByJobID(t *testing.T) {
runIDs, err := orm.FindPipelineRunIDsByJobID(jobs[3].ID, 95, 10)
require.NoError(t, err)
require.Len(t, runIDs, 10)
assert.Equal(t, int64(4*(len(jobs)-1)), runIDs[3]-runIDs[7])
})

// Internally these queries are batched by 1000, this tests case requiring concatenation
Expand All @@ -1483,7 +1482,6 @@ func Test_FindPipelineRunIDsByJobID(t *testing.T) {
runIDs, err := orm.FindPipelineRunIDsByJobID(jobs[3].ID, 95, 100)
require.NoError(t, err)
require.Len(t, runIDs, 100)
assert.Equal(t, int64(67*(len(jobs)-1)), runIDs[12]-runIDs[79])
})

for i := 0; i < 2100; i++ {
Expand All @@ -1497,15 +1495,13 @@ func Test_FindPipelineRunIDsByJobID(t *testing.T) {
runIDs, err := orm.FindPipelineRunIDsByJobID(jobs[3].ID, 0, 25)
require.NoError(t, err)
require.Len(t, runIDs, 25)
assert.Equal(t, int64(16*(len(jobs)-1)), runIDs[7]-runIDs[23])
})

// Same as previous, but where there are fewer matching jobs than the limit
t.Run("with first batch empty, under limit", func(t *testing.T) {
runIDs, err := orm.FindPipelineRunIDsByJobID(jobs[3].ID, 143, 190)
require.NoError(t, err)
require.Len(t, runIDs, 107)
assert.Equal(t, int64(16*(len(jobs)-1)), runIDs[7]-runIDs[23])
})
}

Expand Down
3 changes: 1 addition & 2 deletions integration-tests/ccip-tests/actions/ccip_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
_ "embed"
"fmt"
"math/big"
"strconv"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -2181,7 +2180,7 @@ func (c *CCIPTestEnv) ChaosLabelForCLNodes(t *testing.T) {
for i := c.commitNodeStartIndex; i < len(c.CLNodes); i++ {
labelSelector := map[string]string{
"app": "chainlink-0",
"instance": strconv.Itoa(i),
"instance": fmt.Sprintf("node-%d", i),
}
// commit node starts from index 2
if i >= c.commitNodeStartIndex && i < c.commitNodeStartIndex+c.numOfCommitNodes {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/ccip-tests/load/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (l *loadArgs) Setup(sameCommitAndExec bool) {
lggr := l.lggr
var setUpArgs *testsetups.CCIPTestSetUpOutputs
if !l.TestCfg.ExistingDeployment {
replicas := int64(6)
replicas := 6
if !sameCommitAndExec {
replicas = 12
}
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/ccip-tests/testsetups/ccip.go
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ func CCIPDefaultTestSetUp(
t *testing.T,
lggr zerolog.Logger,
envName string,
numOfCLNodes int64,
numOfCLNodes int,
transferAmounts []*big.Int,
tokenDeployerFns []blockchain.ContractDeployer,
numOfCommitNodes int, commitAndExecOnSameDON, bidirectional bool,
Expand Down Expand Up @@ -907,7 +907,7 @@ func CCIPDefaultTestSetUp(
}
} else {
clProps := make(map[string]interface{})
clProps["replicas"] = strconv.FormatInt(numOfCLNodes, 10)
clProps["replicas"] = numOfCLNodes
clProps["db"] = inputs.CLNodeDBResourceProfile
clProps["chainlink"] = map[string]interface{}{
"resources": inputs.CLNodeResourceProfile,
Expand Down Expand Up @@ -1125,7 +1125,7 @@ func CCIPExistingDeploymentTestSetUp(

func DeployLocalCluster(
t *testing.T,
noOfCLNodes int64,
noOfCLNodes int,
networks []blockchain.EVMNetwork,
) (*test_env.CLClusterTestEnv, func() error) {
env, err := test_env.NewCLTestEnvBuilder().
Expand All @@ -1150,7 +1150,7 @@ func DeployLocalCluster(
if err != nil {
return err
}
return env.StartClNodes(toml, int(noOfCLNodes), "")
return env.StartClNodes(toml, noOfCLNodes, "")
}
return env, deployCL
}
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/chaos/automation_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ AnnounceAddresses = ["0.0.0.0:6690"]
ListenAddresses = ["0.0.0.0:6690"]`

defaultAutomationSettings = map[string]interface{}{
"replicas": "6",
"replicas": 6,
"toml": client.AddNetworksConfig(baseTOML, networks.SelectedNetwork),
"db": map[string]interface{}{
"stateful": true,
Expand Down Expand Up @@ -194,11 +194,11 @@ func TestAutomationChaos(t *testing.T) {
return
}

err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 1, 2, ChaosGroupMinority)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 1, 2, ChaosGroupMinority)
require.NoError(t, err)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 3, 5, ChaosGroupMajority)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 3, 5, ChaosGroupMajority)
require.NoError(t, err)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 2, 5, ChaosGroupMajorityPlus)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 2, 5, ChaosGroupMajorityPlus)
require.NoError(t, err)

chainClient, err := blockchain.NewEVMClient(network, testEnvironment, l)
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/chaos/ocr2vrf_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestOCR2VRFChaos(t *testing.T) {
loadedNetwork := networks.SelectedNetwork

defaultOCR2VRFSettings := map[string]interface{}{
"replicas": "6",
"replicas": 6,
"toml": client.AddNetworkDetailedConfig(
config.BaseOCR2Config,
config.DefaultOCR2VRFNetworkDetailTomlConfig,
Expand Down Expand Up @@ -135,9 +135,9 @@ func TestOCR2VRFChaos(t *testing.T) {
return
}

err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 1, 2, ChaosGroupMinority)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 1, 2, ChaosGroupMinority)
require.NoError(t, err)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 3, 5, ChaosGroupMajority)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 3, 5, ChaosGroupMajority)
require.NoError(t, err)

chainClient, err := blockchain.NewEVMClient(testNetwork, testEnvironment, l)
Expand Down
8 changes: 4 additions & 4 deletions integration-tests/chaos/ocr_chaos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (

var (
defaultOCRSettings = map[string]interface{}{
"replicas": "6",
"replicas": 6,
"db": map[string]interface{}{
"stateful": true,
"capacity": "1Gi",
Expand Down Expand Up @@ -146,11 +146,11 @@ func TestOCRChaos(t *testing.T) {
return
}

err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 1, 2, ChaosGroupMinority)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 1, 2, ChaosGroupMinority)
require.NoError(t, err)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 3, 5, ChaosGroupMajority)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 3, 5, ChaosGroupMajority)
require.NoError(t, err)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=", 2, 5, ChaosGroupMajorityPlus)
err = testEnvironment.Client.LabelChaosGroup(testEnvironment.Cfg.Namespace, "instance=node-", 2, 5, ChaosGroupMajorityPlus)
require.NoError(t, err)

chainClient, err := blockchain.NewEVMClient(blockchain.SimulatedEVMNetwork, testEnvironment, l)
Expand Down
35 changes: 14 additions & 21 deletions integration-tests/docker/test_env/test_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,25 @@ func NewTestEnv() (*CLClusterTestEnv, error) {
if err != nil {
return nil, err
}
networks := []string{network.Name}
n := []string{network.Name}
return &CLClusterTestEnv{
Geth: test_env.NewGeth(n),
MockServer: test_env.NewMockServer(n),
Network: network,
Geth: test_env.NewGeth(networks),
MockServer: test_env.NewMockServer(networks),
l: log.Logger,
}, nil
}

// WithTestEnvConfig sets the test environment cfg.
// Sets up the Geth and MockServer containers with the provided cfg.
func (te *CLClusterTestEnv) WithTestEnvConfig(cfg *TestEnvConfig) *CLClusterTestEnv {
te.Cfg = cfg
n := []string{te.Network.Name}
te.Geth = test_env.NewGeth(n, test_env.WithContainerName(cfg.Geth.ContainerName))
te.MockServer = test_env.NewMockServer(n, test_env.WithContainerName(cfg.MockServer.ContainerName))
return te
}

func (te *CLClusterTestEnv) WithTestLogger(t *testing.T) *CLClusterTestEnv {
te.t = t
te.l = logging.GetTestLogger(t)
Expand All @@ -77,23 +87,6 @@ func (te *CLClusterTestEnv) WithTestLogger(t *testing.T) *CLClusterTestEnv {
return te
}

func NewTestEnvFromCfg(l zerolog.Logger, cfg *TestEnvConfig) (*CLClusterTestEnv, error) {
utils.SetupCoreDockerEnvLogger()
network, err := docker.CreateNetwork(log.Logger)
if err != nil {
return nil, err
}
networks := []string{network.Name}
l.Info().Interface("Cfg", cfg).Send()
return &CLClusterTestEnv{
Cfg: cfg,
Network: network,
Geth: test_env.NewGeth(networks, test_env.WithContainerName(cfg.Geth.ContainerName)),
MockServer: test_env.NewMockServer(networks, test_env.WithContainerName(cfg.MockServer.ContainerName)),
l: log.Logger,
}, nil
}

func (te *CLClusterTestEnv) ParallelTransactions(enabled bool) {
te.EVMClient.ParallelTransactions(enabled)
}
Expand Down Expand Up @@ -125,7 +118,7 @@ func (te *CLClusterTestEnv) StartPrivateChain() error {
for _, chain := range te.PrivateChain {
primaryNode := chain.GetPrimaryNode()
if primaryNode == nil {
return errors.WithStack(fmt.Errorf("Primary node is nil in PrivateChain interface"))
return errors.WithStack(fmt.Errorf("primary node is nil in PrivateChain interface"))
}
err := primaryNode.Start()
if err != nil {
Expand Down
Loading

0 comments on commit db1a0d8

Please sign in to comment.