Skip to content

Commit

Permalink
Updated testconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
smickovskid committed Jun 6, 2024
1 parent 7144a9c commit b6d6ce0
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
2 changes: 1 addition & 1 deletion integration-tests/smoke/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func TestSolanaOCRV2Smoke(t *testing.T) {
prevRound := gauntlet.Transmission{
RoundID: 0,
}
for successFullRounds < *config.OCR2.Smoke.NumberOfRounds {
for successFullRounds < *config.OCR2.NumberOfRounds {
time.Sleep(time.Second * 6)
require.Less(t, stuck, 10, fmt.Sprintf("%s: Rounds have been stuck for more than 10 iterations", name))
log.Info().Str("Transmission", sg.OcrAddress).Msg("Inspecting transmissions")
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/soak/ocr2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ func TestSolanaOCRV2Soak(t *testing.T) {
prevRound := gauntlet.Transmission{
RoundID: 0,
}
for successFullRounds < *config.OCR2.Smoke.NumberOfRounds {
for successFullRounds < *config.OCR2.NumberOfRounds {
// Since it is a soak bumping the stuck count
require.Less(t, stuck, 100, "Rounds have been stuck for more than 10 iterations")
log.Info().Str("Transmission", sg.OcrAddress).Msg("Inspecting transmissions")
Expand Down
7 changes: 6 additions & 1 deletion integration-tests/testconfig/default.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ devnet_image = "solanalabs/solana:v1.17.34"
[OCR2]
node_count = 6
test_duration = "50m"
number_of_rounds = 2

[OCR2.Smoke]
number_of_rounds = 2
enabled = true

[OCR2.Soak]
enabled = false


46 changes: 41 additions & 5 deletions integration-tests/testconfig/ocr2/ocr2.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ import (
type Config struct {
Smoke *SmokeConfig `toml:"Smoke"`
NodeCount *int `toml:"node_count"`
NumberOfRounds *int `toml:"number_of_rounds"`
TestDuration *string `toml:"test_duration"`
TestDurationParsed *time.Duration
Soak *SoakConfig `toml:"Soak"`
}

type SoakConfig struct {
Enabled *bool `toml:"enabled"`
DetachRunner *bool `toml:"detach_runner"`
RemoteRunnerImage *string `toml:"remote_runner_image"`
}

func (o *Config) Validate() error {
Expand All @@ -26,24 +34,52 @@ func (o *Config) Validate() error {
}
o.TestDurationParsed = &duration

if o.Smoke == nil {
return errors.New("smoke must be defined")
if o.NumberOfRounds == nil {
return errors.New("number_of_rounds must be set for OCR2")
}

if o.Smoke.Enabled == nil && o.Soak.Enabled == nil {
return errors.New("OCR2.Smoke or OCR2.Soak must be defined")
}

err = o.Smoke.Validate()
if err != nil {
return err
}

err = o.Soak.Validate()
if err != nil {
return err
}

return nil
}

type SmokeConfig struct {
NumberOfRounds *int `toml:"number_of_rounds"`
Enabled *bool `toml:"enabled"`
}

func (o *SmokeConfig) Validate() error {
if o.NumberOfRounds == nil {
return errors.New("number_of_rounds must be set")
if o.Enabled == nil {
return errors.New("enabled must be set for OCR2.Smoke")
}

return nil
}

func (o *SoakConfig) Validate() error {
if o.Enabled == nil {
return errors.New("enabled must be set for OCR2.Soak")
}

if *o.Enabled {
if o.RemoteRunnerImage == nil {
return errors.New("remote_runner_image must be set for OCR2.Soak")
}
if o.DetachRunner == nil {
return errors.New("detach_runner must be set for OCR2.Soak")
}
}

return nil
}

0 comments on commit b6d6ce0

Please sign in to comment.