Skip to content

Commit

Permalink
use separate endpoint for listing versions
Browse files Browse the repository at this point in the history
  • Loading branch information
idoqo committed Jul 24, 2024
1 parent 2a75109 commit fa1c630
Show file tree
Hide file tree
Showing 16 changed files with 2,044 additions and 386 deletions.
27 changes: 27 additions & 0 deletions api-tests/server/updates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,33 @@ func TestCheckUpdates(t *testing.T) {
})
}

func TestListUpdates(t *testing.T) {
const fast, slow = 5 * time.Second, 60 * time.Second

if !pmmapitests.RunUpdateTest {
t.Skip("skipping PMM Server check update test")
}

// that call should always be fast
version, err := serverClient.Default.Server.Version(server.NewVersionParamsWithTimeout(fast))

Check failure on line 131 in api-tests/server/updates_test.go

View workflow job for this annotation

GitHub Actions / Checks

serverClient.Default.Server undefined (type *"github.com/percona/pmm/api/server/v1/json/client".PMMServerAPI has no field or method Server)
require.NoError(t, err)
if version.Payload.Server == nil || version.Payload.Server.Version == "" {
t.Skip("skipping test in developer's environment")
}

params := &server.ListUpdatesParams{
Context: pmmapitests.Context,
}
params.SetTimeout(slow) // that call can be slow with a cold cache
res, err := serverClient.Default.Server.ListUpdates(params)

Check failure on line 141 in api-tests/server/updates_test.go

View workflow job for this annotation

GitHub Actions / Checks

serverClient.Default.Server undefined (type *"github.com/percona/pmm/api/server/v1/json/client".PMMServerAPI has no field or method Server) (typecheck)
require.NoError(t, err)

if len(res.Payload.Updates) > 0 {
assert.True(t, strings.HasPrefix(res.Payload.Updates[0].Version, "3."),
"installed.version = %q should have '3.' prefix", res.Payload.Updates[0].Version)
}
}

func TestUpdate(t *testing.T) {
// do not run this test in parallel with other tests

Expand Down
127 changes: 127 additions & 0 deletions api/server/v1/json/client/server_service/list_updates_parameters.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fa1c630

Please sign in to comment.