Skip to content

Commit

Permalink
Adjusted test duration logic
Browse files Browse the repository at this point in the history
  • Loading branch information
smickovskid committed May 20, 2024
1 parent a81266e commit 8a66300
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
7 changes: 1 addition & 6 deletions integration-tests/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ func stripKeyPrefix(key string) string {
func New(testConfig *tc.TestConfig) *Common {
var c *Common

duration, err := time.ParseDuration(*testConfig.OCR2.TestDuration)
if err != nil {
panic("Invalid test duration")
}

// Setting localnet as the default config
config := chainConfig.LocalNetConfig()
// Getting the default localnet private key
Expand Down Expand Up @@ -166,7 +161,7 @@ func New(testConfig *tc.TestConfig) *Common {
},
TestConfig: testConfig,
TestEnvDetails: &TestEnvDetails{
TestDuration: duration,
TestDuration: *testConfig.OCR2.TestDurationParsed,
},
AccountDetails: &AccountDetails{
PrivateKey: privateKeyString,
Expand Down
14 changes: 11 additions & 3 deletions integration-tests/testconfig/ocr2/ocr2.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ package ocr2

import (
"errors"
"time"
)

type Config struct {
Smoke *SmokeConfig `toml:"Smoke"`
NodeCount *int `toml:"node_count"`
TestDuration *string `toml:"test_duration"`
Smoke *SmokeConfig `toml:"Smoke"`
NodeCount *int `toml:"node_count"`
TestDuration *string `toml:"test_duration"`
TestDurationParsed *time.Duration
}

func (o *Config) Validate() error {
Expand All @@ -17,6 +19,12 @@ func (o *Config) Validate() error {

if o.TestDuration == nil {
return errors.New("test_duration must be set")
} else {
duration, err := time.ParseDuration(*o.TestDuration)
if err != nil {
return errors.New("Invalid test duration")
}
o.TestDurationParsed = &duration
}

if o.Smoke == nil {
Expand Down

0 comments on commit 8a66300

Please sign in to comment.