Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix test performance flaky test #3316

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/createdkg_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ func TestValidateWithdrawalAddr(t *testing.T) {
}

func TestValidateDKGConfig(t *testing.T) {

t.Run("insufficient ENRs", func(t *testing.T) {
numOperators := 2
err := validateDKGConfig(numOperators, "", nil)
Expand Down
8 changes: 7 additions & 1 deletion cmd/testpeers_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,13 +384,15 @@ func testWriteFile(t *testing.T, expectedRes testCategoryResult, path string) {
require.NoError(t, err)

require.Equal(t, expectedRes.CategoryName, res.CategoryName)
require.Equal(t, expectedRes.Score, res.Score)
require.Equal(t, len(expectedRes.Targets), len(res.Targets))
checkFinalScore := true
for targetName, testResults := range res.Targets {
for idx, testRes := range testResults {
// do not test verdicts based on measurements
if expectedRes.Targets[targetName][idx].Verdict == testVerdictOk || expectedRes.Targets[targetName][idx].Verdict == testVerdictFail {
require.Equal(t, expectedRes.Targets[targetName][idx].Verdict, testRes.Verdict)
} else {
checkFinalScore = false
}
require.Equal(t, expectedRes.Targets[targetName][idx].IsAcceptable, testRes.IsAcceptable)
if expectedRes.Targets[targetName][idx].Error.error != nil {
Expand All @@ -402,6 +404,10 @@ func testWriteFile(t *testing.T, expectedRes testCategoryResult, path string) {
require.Equal(t, expectedRes.Targets[targetName][idx].Suggestion, testRes.Suggestion)
}
}
// check final score only if there are no tests based on actual measurement
if checkFinalScore {
require.Equal(t, expectedRes.Score, res.Score)
}
}

func startPeer(t *testing.T, conf testPeersConfig, peerPrivKey *k1.PrivateKey) enr.Record {
Expand Down
Loading