Skip to content

Commit

Permalink
[TT-526] Allow Parallel Tests To Work
Browse files Browse the repository at this point in the history
Use unique base config for each env
  • Loading branch information
tateexon committed Sep 11, 2023
1 parent c23b078 commit e413ab4
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 144 deletions.
2 changes: 1 addition & 1 deletion integration-tests/docker/test_env/test_env_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ func (b *CLTestEnvBuilder) buildNewEnv(cfg *TestEnvConfig) (*CLClusterTestEnv, e
if b.clNodeConfig != nil {
cfg = b.clNodeConfig
} else {
cfg = node.NewConfig(node.BaseConf,
cfg = node.NewConfig(node.NewBaseConfig(),
node.WithOCR1(),
node.WithP2Pv1(),
)
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/scripts/buildTestMatrixList.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ matrix_output() {
# Read the JSON file and loop through 'tests' and 'run'
jq -c '.tests[]' ${JSONFILE} | while read -r test; do
testName=$(echo ${test} | jq -r '.name')
label=$(echo ${test} | jq -r '.label // empty')
effective_node_label=${label:-$NODE_LABEL}
subTests=$(echo ${test} | jq -r '.run[]?.name // empty')
output=""

Expand All @@ -41,14 +43,14 @@ jq -c '.tests[]' ${JSONFILE} | while read -r test; do
if [ $COUNTER -ne 1 ]; then
echo -n ","
fi
matrix_output $COUNTER $MATRIX_JOB_NAME "${testName}/${subTest}" ${NODE_LABEL}
matrix_output $COUNTER $MATRIX_JOB_NAME "${testName}/${subTest}" ${effective_node_label}
((COUNTER++))
done
else
if [ $COUNTER -ne 1 ]; then
echo -n ","
fi
matrix_output $COUNTER $MATRIX_JOB_NAME "${testName}" ${NODE_LABEL}
matrix_output $COUNTER $MATRIX_JOB_NAME "${testName}" ${effective_node_label}
((COUNTER++))
fi

Expand Down
2 changes: 1 addition & 1 deletion integration-tests/smoke/automation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ func setupAutomationTestDocker(
network := networks.SelectedNetwork

// build the node config
clNodeConfig := node.NewConfig(node.BaseConf)
clNodeConfig := node.NewConfig(node.NewBaseConfig())
syncInterval := models.MustMakeDuration(5 * time.Minute)
clNodeConfig.Feature.LogPoller = it_utils.Ptr[bool](true)
clNodeConfig.OCR2.Enabled = it_utils.Ptr[bool](true)
Expand Down
89 changes: 9 additions & 80 deletions integration-tests/smoke/automation_test.go_test_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,105 +2,34 @@
"tests": [
{
"name": "TestAutomationBasic",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1_conditional"
},
{
"name": "registry_2_1_logtrigger"
}
]
"label": "ubuntu20.04-32cores-128GB"
},
{
"name": "TestAutomationAddFunds",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1"
}
]
"name": "TestAutomationAddFunds"
},
{
"name": "TestAutomationPauseUnPause",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1"
}
]
"label": "ubuntu20.04-16cores-64GB"
},
{
"name": "TestAutomationRegisterUpkeep",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1"
}
]
"name": "TestAutomationRegisterUpkeep"
},
{
"name": "TestAutomationPauseRegistry",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1"
}
]
"name": "TestAutomationPauseRegistry"
},
{
"name": "TestAutomationKeeperNodesDown",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1"
}
]
"label": "ubuntu20.04-16cores-64GB"
},
{
"name": "TestAutomationPerformSimulation",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1"
}
]
"name": "TestAutomationPerformSimulation"
},
{
"name": "TestAutomationCheckPerformGasLimit",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1"
}
]
"label": "ubuntu20.04-16cores-64GB"
},
{
"name": "TestUpdateCheckData",
"run": [
{
"name": "registry_2_0"
},
{
"name": "registry_2_1"
}
]
"name": "TestUpdateCheckData"
},
{
"name": "TestSetUpkeepTriggerConfig"
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/smoke/forwarders_ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestForwarderOCR2Basic(t *testing.T) {
env, err := test_env.NewCLTestEnvBuilder().
WithGeth().
WithMockServer(1).
WithCLNodeConfig(node.NewConfig(node.BaseConf,
WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(),
node.WithOCR2(),
node.WithP2Pv2(),
)).
Expand Down
59 changes: 35 additions & 24 deletions integration-tests/smoke/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ func TestKeeperBasicSmoke(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts(
t,
registryVersion,
Expand Down Expand Up @@ -157,10 +158,11 @@ func TestKeeperBlockCountPerTurn(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts(
t,
registryVersion,
Expand Down Expand Up @@ -259,10 +261,11 @@ func TestKeeperSimulation(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, _, consumersPerformance, upkeepIDs := actions.DeployPerformanceKeeperContracts(
t,
registryVersion,
Expand Down Expand Up @@ -331,8 +334,10 @@ func TestKeeperCheckPerformGasLimit(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, _, consumersPerformance, upkeepIDs := actions.DeployPerformanceKeeperContracts(
t,
Expand Down Expand Up @@ -442,10 +447,11 @@ func TestKeeperRegisterUpkeep(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, registrar, consumers, upkeepIDs := actions.DeployKeeperContracts(
t,
registryVersion,
Expand Down Expand Up @@ -529,10 +535,11 @@ func TestKeeperAddFunds(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts(
t,
registryVersion,
Expand Down Expand Up @@ -591,10 +598,11 @@ func TestKeeperRemove(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts(
t,
registryVersion,
Expand Down Expand Up @@ -667,10 +675,11 @@ func TestKeeperPauseRegistry(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts(
t,
registryVersion,
Expand Down Expand Up @@ -818,8 +827,10 @@ func TestKeeperNodeDown(t *testing.T) {
ethereum.RegistryVersion_1_3,
}

for _, registryVersion := range registryVersions {
for _, rv := range registryVersions {
registryVersion := rv
t.Run(fmt.Sprintf("registry_1_%d", registryVersion), func(t *testing.T) {
t.Parallel()
chainClient, chainlinkNodes, contractDeployer, linkToken, _ := setupKeeperTest(t)
registry, _, consumers, upkeepIDs := actions.DeployKeeperContracts(
t,
Expand Down Expand Up @@ -1082,7 +1093,7 @@ func setupKeeperTest(t *testing.T) (
contracts.LinkToken,
*test_env.CLClusterTestEnv,
) {
clNodeConfig := node.NewConfig(node.BaseConf)
clNodeConfig := node.NewConfig(node.NewBaseConfig())
turnLookBack := int64(0)
syncInterval := models.MustMakeDuration(5 * time.Second)
performGasOverhead := uint32(150000)
Expand Down
36 changes: 5 additions & 31 deletions integration-tests/smoke/keeper_test.go_test_list.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,19 @@
{
"tests": [
{
"name": "TestKeeperBasicSmoke"
"name": "TestKeeperBasicSmoke",
"label": "ubuntu20.04-32cores-128GB"
},
{
"name": "TestKeeperBlockCountPerTurn",
"run": [
{
"name": "registry_1_1"
},
{
"name": "registry_1_2"
},
{
"name": "registry_1_3"
}
]
"label": "ubuntu20.04-32cores-128GB"
},
{
"name": "TestKeeperSimulation"
},
{
"name": "TestKeeperCheckPerformGasLimit",
"run": [
{
"name": "registry_1_2"
},
{
"name": "registry_1_3"
}
]
"label": "ubuntu20.04-16cores-64GB"
},
{
"name": "TestKeeperRegisterUpkeep"
Expand All @@ -48,17 +32,7 @@
},
{
"name": "TestKeeperNodeDown",
"run": [
{
"name": "registry_1_1"
},
{
"name": "registry_1_2"
},
{
"name": "registry_1_3"
}
]
"label": "ubuntu20.04-32cores-128GB"
},
{
"name": "TestKeeperPauseUnPauseUpkeep"
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 @@ -34,7 +34,7 @@ func TestOCRv2Basic(t *testing.T) {
env, err := test_env.NewCLTestEnvBuilder().
WithGeth().
WithMockServer(1).
WithCLNodeConfig(node.NewConfig(node.BaseConf,
WithCLNodeConfig(node.NewConfig(node.NewBaseConfig(),
node.WithOCR2(),
node.WithP2Pv2(),
)).
Expand Down
6 changes: 3 additions & 3 deletions integration-tests/types/config/node/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import (
utils2 "github.com/smartcontractkit/chainlink/integration-tests/utils"
)

var (
BaseConf = &chainlink.Config{
func NewBaseConfig() *chainlink.Config {
return &chainlink.Config{
Core: toml.Core{
RootDir: utils2.Ptr("/home/chainlink"),
Database: toml.Database{
Expand Down Expand Up @@ -60,7 +60,7 @@ var (
P2P: toml.P2P{},
},
}
)
}

type NodeConfigOpt = func(c *chainlink.Config)

Expand Down

0 comments on commit e413ab4

Please sign in to comment.