From 447273563b7091bed088a73bb40b279e357959e1 Mon Sep 17 00:00:00 2001 From: Kaloyan Tanev Date: Thu, 3 Oct 2024 14:22:08 +0300 Subject: [PATCH] Check final score only if no tests based on measurement --- cmd/createdkg_internal_test.go | 1 - cmd/testpeers_internal_test.go | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/createdkg_internal_test.go b/cmd/createdkg_internal_test.go index 3e93ebaff..c6f9371e0 100644 --- a/cmd/createdkg_internal_test.go +++ b/cmd/createdkg_internal_test.go @@ -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) diff --git a/cmd/testpeers_internal_test.go b/cmd/testpeers_internal_test.go index 1d9fb8e4a..1c15a71d8 100644 --- a/cmd/testpeers_internal_test.go +++ b/cmd/testpeers_internal_test.go @@ -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 { @@ -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 {