Skip to content

Commit

Permalink
Fix test names inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
KaloyanTanev committed Nov 16, 2024
1 parent 1a6d324 commit f93cee3
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 205 deletions.
48 changes: 23 additions & 25 deletions cmd/testbeacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,19 +189,19 @@ func bindTestBeaconFlags(cmd *cobra.Command, config *testBeaconConfig, flagsPref

func supportedBeaconTestCases() map[testCaseName]testCaseBeacon {
return map[testCaseName]testCaseBeacon{
{name: "ping", order: 1}: beaconPingTest,
{name: "pingMeasure", order: 2}: beaconPingMeasureTest,
{name: "version", order: 3}: beaconVersionTest,
{name: "isSynced", order: 4}: beaconIsSyncedTest,
{name: "peerCount", order: 5}: beaconPeerCountTest,
{name: "pingLoad", order: 6}: beaconPingLoadTest,
{name: "Ping", order: 1}: beaconPingTest,
{name: "PingMeasure", order: 2}: beaconPingMeasureTest,
{name: "Version", order: 3}: beaconVersionTest,
{name: "Synced", order: 4}: beaconIsSyncedTest,
{name: "PeerCount", order: 5}: beaconPeerCountTest,
{name: "PingLoad", order: 6}: beaconPingLoadTest,

{name: "simulate1", order: 7}: beaconSimulation1Test,
{name: "simulate10", order: 8}: beaconSimulation10Test,
{name: "simulate100", order: 9}: beaconSimulation100Test,
{name: "simulate500", order: 10}: beaconSimulation500Test,
{name: "simulate1000", order: 11}: beaconSimulation1000Test,
{name: "simulateCustom", order: 12}: beaconSimulationCustomTest,
{name: "Simulate1", order: 7}: beaconSimulation1Test,
{name: "Simulate10", order: 8}: beaconSimulation10Test,
{name: "Simulate100", order: 9}: beaconSimulation100Test,
{name: "Simulate500", order: 10}: beaconSimulation500Test,
{name: "Simulate1000", order: 11}: beaconSimulation1000Test,
{name: "SimulateCustom", order: 12}: beaconSimulationCustomTest,
}
}

Expand Down Expand Up @@ -317,9 +317,7 @@ func testSingleBeacon(ctx context.Context, queuedTestCases []testCaseName, allTe
finished = true
break
}
testName = queuedTestCases[testCounter].name
testCounter++
result.Name = testName
allTestRes = append(allTestRes, result)
}
}
Expand Down Expand Up @@ -378,7 +376,7 @@ func beaconPingMeasureTest(ctx context.Context, _ *testBeaconConfig, target stri
}

func beaconVersionTest(ctx context.Context, _ *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "version"}
testRes := testResult{Name: "Version"}

type versionData struct {
Version string `json:"version"`
Expand Down Expand Up @@ -427,7 +425,7 @@ func beaconVersionTest(ctx context.Context, _ *testBeaconConfig, target string)
}

func beaconPingLoadTest(ctx context.Context, conf *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "BeaconLoad"}
testRes := testResult{Name: "PingLoad"}
if !conf.LoadTest {
testRes.Verdict = testVerdictSkipped
return testRes
Expand Down Expand Up @@ -465,7 +463,7 @@ func beaconPingLoadTest(ctx context.Context, conf *testBeaconConfig, target stri
}

func beaconIsSyncedTest(ctx context.Context, _ *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "isSynced"}
testRes := testResult{Name: "Synced"}

type isSyncedResponse struct {
Data eth2v1.SyncState `json:"data"`
Expand Down Expand Up @@ -508,7 +506,7 @@ func beaconIsSyncedTest(ctx context.Context, _ *testBeaconConfig, target string)
}

func beaconPeerCountTest(ctx context.Context, _ *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "peerCount"}
testRes := testResult{Name: "PeerCount"}

type peerCountResponseMeta struct {
Count int `json:"count"`
Expand Down Expand Up @@ -582,7 +580,7 @@ func pingBeaconContinuously(ctx context.Context, target string, resCh chan<- tim
// beacon simulation tests

func beaconSimulation1Test(ctx context.Context, conf *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "BeaconSimulation1Validator"}
testRes := testResult{Name: "Simulate1"}
if !conf.LoadTest {
testRes.Verdict = testVerdictSkipped
return testRes
Expand All @@ -607,7 +605,7 @@ func beaconSimulation1Test(ctx context.Context, conf *testBeaconConfig, target s
}

func beaconSimulation10Test(ctx context.Context, conf *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "BeaconSimulation10Validators"}
testRes := testResult{Name: "Simulate10"}
if !conf.LoadTest {
testRes.Verdict = testVerdictSkipped
return testRes
Expand All @@ -632,7 +630,7 @@ func beaconSimulation10Test(ctx context.Context, conf *testBeaconConfig, target
}

func beaconSimulation100Test(ctx context.Context, conf *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "BeaconSimulation100Validators"}
testRes := testResult{Name: "Simulate100"}
if !conf.LoadTest {
testRes.Verdict = testVerdictSkipped
return testRes
Expand All @@ -657,7 +655,7 @@ func beaconSimulation100Test(ctx context.Context, conf *testBeaconConfig, target
}

func beaconSimulation500Test(ctx context.Context, conf *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "BeaconSimulation500Validators"}
testRes := testResult{Name: "Simulate500"}
if !conf.LoadTest {
testRes.Verdict = testVerdictSkipped
return testRes
Expand All @@ -682,7 +680,7 @@ func beaconSimulation500Test(ctx context.Context, conf *testBeaconConfig, target
}

func beaconSimulation1000Test(ctx context.Context, conf *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "BeaconSimulation1000Validators"}
testRes := testResult{Name: "Simulate1000"}
if !conf.LoadTest {
testRes.Verdict = testVerdictSkipped
return testRes
Expand All @@ -707,12 +705,12 @@ func beaconSimulation1000Test(ctx context.Context, conf *testBeaconConfig, targe
}

func beaconSimulationCustomTest(ctx context.Context, conf *testBeaconConfig, target string) testResult {
testRes := testResult{Name: "BeaconSimulationCustomValidators"}
testRes := testResult{Name: "SimulateCustom"}
if conf.SimulationCustom < 1 {
testRes.Verdict = testVerdictSkipped
return testRes
}
testRes.Name = fmt.Sprintf("BeaconSimulation%vValidators", conf.SimulationCustom)
testRes.Name = fmt.Sprintf("Simulate%v", conf.SimulationCustom)

total := conf.SimulationCustom
syncCommittees := total / 100
Expand Down
82 changes: 41 additions & 41 deletions cmd/testbeacon_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ func TestBeaconTest(t *testing.T) {
expected: testCategoryResult{
Targets: map[string][]testResult{
mockedBeaconNode.URL: {
{Name: "ping", Verdict: testVerdictOk, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "pingMeasure", Verdict: testVerdictGood, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "version", Verdict: testVerdictOk, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "isSynced", Verdict: testVerdictOk, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "peerCount", Verdict: testVerdictGood, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "pingLoad", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate1", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate10", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate100", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate500", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate1000", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulateCustom", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Ping", Verdict: testVerdictOk, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "PingMeasure", Verdict: testVerdictGood, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Version", Verdict: testVerdictOk, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Synced", Verdict: testVerdictOk, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "PeerCount", Verdict: testVerdictGood, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "PingLoad", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate1", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate10", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate100", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate500", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate1000", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "SimulateCustom", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
},
},
},
Expand Down Expand Up @@ -98,10 +98,10 @@ func TestBeaconTest(t *testing.T) {
expected: testCategoryResult{
Targets: map[string][]testResult{
endpoint1: {
{Name: "ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: errTimeoutInterrupted},
{Name: "Ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: errTimeoutInterrupted},
},
endpoint2: {
{Name: "ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: errTimeoutInterrupted},
{Name: "Ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: errTimeoutInterrupted},
},
},
},
Expand Down Expand Up @@ -143,18 +143,18 @@ func TestBeaconTest(t *testing.T) {
testConfig: testConfig{
OutputJSON: "",
Quiet: false,
TestCases: []string{"ping"},
TestCases: []string{"Ping"},
Timeout: time.Minute,
},
Endpoints: []string{endpoint1, endpoint2},
},
expected: testCategoryResult{
Targets: map[string][]testResult{
endpoint1: {
{Name: "ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "Ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
},
endpoint2: {
{Name: "ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "Ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
},
},
},
Expand Down Expand Up @@ -217,32 +217,32 @@ func TestBeaconTest(t *testing.T) {
func defaultFailingBNTests(_ *testing.T, endpoint1 string, endpoint2 string, port1 int, port2 int) map[string][]testResult {
return map[string][]testResult{
endpoint1: {
{Name: "ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "pingMeasure", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "version", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "isSynced", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "peerCount", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "pingLoad", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate1", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate10", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate100", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate500", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate1000", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulateCustom", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "PingMeasure", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "Version", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "Synced", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "PeerCount", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port1))}},
{Name: "PingLoad", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate1", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate10", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate100", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate500", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate1000", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "SimulateCustom", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
},
endpoint2: {
{Name: "ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "pingMeasure", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "version", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "isSynced", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "peerCount", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "pingLoad", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate1", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate10", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate100", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate500", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulate1000", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "simulateCustom", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Ping", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "PingMeasure", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "Version", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "Synced", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "PeerCount", Verdict: testVerdictFail, Measurement: "", Suggestion: "", Error: testResultError{errors.New(fmt.Sprintf(`%v: connect: connection refused`, port2))}},
{Name: "PingLoad", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate1", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate10", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate100", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate500", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "Simulate1000", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
{Name: "SimulateCustom", Verdict: testVerdictSkipped, Measurement: "", Suggestion: "", Error: testResultError{}},
},
}
}
Expand Down
20 changes: 9 additions & 11 deletions cmd/testinfra.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ func bindTestInfraFlags(cmd *cobra.Command, config *testInfraConfig, flagsPrefix

func supportedInfraTestCases() map[testCaseName]func(context.Context, *testInfraConfig) testResult {
return map[testCaseName]func(context.Context, *testInfraConfig) testResult{
{name: "diskWriteSpeed", order: 1}: infraDiskWriteSpeedTest,
{name: "diskWriteIOPS", order: 2}: infraDiskWriteIOPSTest,
{name: "diskReadSpeed", order: 3}: infraDiskReadSpeedTest,
{name: "diskReadIOPS", order: 4}: infraDiskReadIOPSTest,
{name: "availableMemory", order: 5}: infraAvailableMemoryTest,
{name: "totalMemory", order: 6}: infraTotalMemoryTest,
{name: "internetLatency", order: 7}: infraInternetLatencyTest,
{name: "internetDownloadSpeed", order: 8}: infraInternetDownloadSpeedTest,
{name: "internetUploadSpeed", order: 9}: infraInternetUploadSpeedTest,
{name: "DiskWriteSpeed", order: 1}: infraDiskWriteSpeedTest,
{name: "DiskWriteIOPS", order: 2}: infraDiskWriteIOPSTest,
{name: "DiskReadSpeed", order: 3}: infraDiskReadSpeedTest,
{name: "DiskReadIOPS", order: 4}: infraDiskReadIOPSTest,
{name: "AvailableMemory", order: 5}: infraAvailableMemoryTest,
{name: "TotalMemory", order: 6}: infraTotalMemoryTest,
{name: "InternetLatency", order: 7}: infraInternetLatencyTest,
{name: "InternetDownloadSpeed", order: 8}: infraInternetDownloadSpeedTest,
{name: "InternetUploadSpeed", order: 9}: infraInternetUploadSpeedTest,
}
}

Expand Down Expand Up @@ -199,9 +199,7 @@ func testSingleInfra(ctx context.Context, queuedTestCases []testCaseName, allTes
finished = true
break
}
testName = queuedTestCases[testCounter].name
testCounter++
result.Name = testName
allTestRes = append(allTestRes, result)
}
}
Expand Down
Loading

0 comments on commit f93cee3

Please sign in to comment.