Skip to content

Commit

Permalink
Allow nil in latest tests
Browse files Browse the repository at this point in the history
There is a possibility of nil (when we don't have any tag available).
This updates the test to allow such cases and only check if latest is
not nil
  • Loading branch information
idoqo committed Nov 14, 2024
1 parent 093a439 commit 62d1d73
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions managed/services/server/updater_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,10 @@ func TestUpdater(t *testing.T) {
u := NewUpdater(watchtowerURL, gRPCMessageMaxSize)
_, latest, err := u.latest(context.Background())
require.NoError(t, err)
assert.NotNil(t, latest)
assert.True(t, strings.HasPrefix(latest.Version.String(), "2.") || strings.HasPrefix(latest.Version.String(), "3."),
"latest version of PMM should have either a '2.' or '3.' prefix")
if latest != nil {
assert.True(t, strings.HasPrefix(latest.Version.String(), "2.") || strings.HasPrefix(latest.Version.String(), "3."),
"latest version of PMM should have either a '2.' or '3.' prefix")
}
})

t.Run("TestParseFile", func(t *testing.T) {
Expand Down

0 comments on commit 62d1d73

Please sign in to comment.