Skip to content

Commit

Permalink
fix: Make printWarningIfArgumentIsDeprecated unit test deterministic (#…
Browse files Browse the repository at this point in the history
…633)

## Description:
<!-- Describe this change, how it works, and the motivation behind it.
-->
`printWarningIfArgumentIsDeprecated` is flaky:


https://app.circleci.com/pipelines/github/kurtosis-tech/kurtosis/3488/workflows/72a67e18-3fae-4734-b97b-47f278c39b3a/jobs/42730

This is because the test relies on a given order of iteration of
`sync.Map`, that is not deterministic and will yield different order
from time to time.

## Is this change user facing?
NO
<!-- If yes, please add the "user facing" label to the PR -->
<!-- If yes, don't forget to include docs changes where relevant -->

## References (if applicable):
<!-- Add relevant Github Issues, Discord threads, or other helpful
information. -->
  • Loading branch information
victorcolombo committed May 22, 2023
1 parent 0e212c9 commit 46bbee5
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,14 @@ func Test_printWarningIfArgumentIsDeprecated(t *testing.T) {
require.Len(t, warnings, 2)

// just checking only one warning to make sure that the string formatting works
require.Contains(t, warnings[0],
fmt.Sprintf("%q field for %q will be deprecated by %v. %v",
"config",
"kurtosis_builtin",
deprecatedDate.GetFormattedDate(),
deprecatedMitigation,
))
expectedWarning := fmt.Sprintf("[WARN]: %q field for %q will be deprecated by %v. %v",
"config",
"kurtosis_builtin",
deprecatedDate.GetFormattedDate(),
deprecatedMitigation,
)
require.Contains(t, warnings, expectedWarning)

}

func Test_printWarningForBuiltinIsDeprecated(t *testing.T) {
Expand Down

0 comments on commit 46bbee5

Please sign in to comment.