Skip to content

Commit

Permalink
Add OCR soak tests with blockchain reorg (#13541)
Browse files Browse the repository at this point in the history
* Add reorg test configs for ocr soak test

* Create separate test functions for soak test configuration

This will allow the separate tests to be executed in remote test runner

* Revert common.go

* Add tests to makefile and fix missing config values
  • Loading branch information
lukaszcl authored Jun 13, 2024
1 parent c55db97 commit 0a877dd
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 3 deletions.
12 changes: 11 additions & 1 deletion integration-tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,17 @@ test_node_migrations_simulated_verbose:
.PHONY: test_soak_ocr
test_soak_ocr:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run TestOCRSoak ./soak
go test -v -count=1 -run ^TestOCRSoak$$ ./soak

.PHONY: test_soak_ocr_reorg_1
test_soak_ocr_reorg_1:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run ^TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled$$ ./soak

.PHONY: test_soak_ocr_reorg_2
test_soak_ocr_reorg_2:
. ./scripts/check_base64_env_var.sh
go test -v -count=1 -run ^TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled$$ ./soak

.PHONY: test_soak_forwarder_ocr
test_soak_forwarder_ocr:
Expand Down
21 changes: 19 additions & 2 deletions integration-tests/soak/ocr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,34 @@ import (
)

func TestOCRSoak(t *testing.T) {
l := logging.GetTestLogger(t)
// Use this variable to pass in any custom EVM specific TOML values to your Chainlink nodes
customNetworkTOML := ``
// Uncomment below for debugging TOML issues on the node
// network := networks.MustGetSelectedNetworksFromEnv()[0]
// fmt.Println("Using Chainlink TOML\n---------------------")
// fmt.Println(networks.AddNetworkDetailedConfig(config.BaseOCR1Config, customNetworkTOML, network))
// fmt.Println("---------------------")

config, err := tc.GetConfig("Soak", tc.OCR)
require.NoError(t, err, "Error getting config")
runOCRSoakTest(t, config, customNetworkTOML)
}

func TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled(t *testing.T) {
config, err := tc.GetConfig(t.Name(), tc.OCR)
require.NoError(t, err, "Error getting config")
runOCRSoakTest(t, config, "")
}

func TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled(t *testing.T) {
config, err := tc.GetConfig(t.Name(), tc.OCR)
require.NoError(t, err, "Error getting config")
runOCRSoakTest(t, config, "")
}

func runOCRSoakTest(t *testing.T, config tc.TestConfig, customNetworkTOML string) {
l := logging.GetTestLogger(t)

l.Info().Str("test", t.Name()).Msg("Starting OCR soak test")

ocrSoakTest, err := testsetups.NewOCRSoakTest(t, &config, false)
require.NoError(t, err, "Error creating soak test")
Expand Down
54 changes: 54 additions & 0 deletions integration-tests/testconfig/ocr/ocr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,57 @@ test_duration="15m"
ocr_version="1"
number_of_contracts=2
time_between_rounds="1m"

# Soak test configuration with Geth reorg below finality with FinalityTagEnabled=false
[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.NodeConfig]
CommonChainConfigTOML = """
AutoCreateKey = true
MinContractPayment = 0
LogPollInterval="500ms"
BackupLogPollerBlockDelay = 0
FinalityDepth = 30
FinalityTagEnabled = false
"""
[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.Network]
selected_networks=["simulated"]
[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.Network.GethReorgConfig]
enabled = true
depth = 15
delay_create = "3s"
[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.Common]
chainlink_node_funding = 100
[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.OCR]
[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.OCR.Common]
test_duration="15m"
[TestOCRSoak_GethReorgBelowFinality_FinalityTagDisabled.OCR.Soak]
ocr_version="1"
number_of_contracts=2
time_between_rounds="1m"

# Soak test configuration with Geth reorg below finality with FinalityTagEnabled=true
[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.NodeConfig]
CommonChainConfigTOML = """
AutoCreateKey = true
MinContractPayment = 0
LogPollInterval="500ms"
BackupLogPollerBlockDelay = 0
FinalityTagEnabled = true
[HeadTracker]
HistoryDepth = 10
"""
[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.Network]
selected_networks=["simulated"]
[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.Network.GethReorgConfig]
enabled = true
depth = 15
delay_create = "3s"
[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.Common]
chainlink_node_funding = 100
[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.OCR]
[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.OCR.Common]
test_duration="15m"
[TestOCRSoak_GethReorgBelowFinality_FinalityTagEnabled.OCR.Soak]
ocr_version="1"
number_of_contracts=2
time_between_rounds="1m"

0 comments on commit 0a877dd

Please sign in to comment.