Skip to content

Commit

Permalink
PMM-13078 List available client versions (#3077)
Browse files Browse the repository at this point in the history
* PMM-13078 List available client versions

* PMM-13078 add unit tests

* PMM-13078 add an API test

* PMM-13078 follow up on PR review comments

* PMM-13078 address review comments
  • Loading branch information
ademidoff authored Jul 29, 2024
1 parent 0ac861d commit 439e2fc
Show file tree
Hide file tree
Showing 18 changed files with 2,191 additions and 244 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ RUN export GOPATH=$(go env GOPATH) && \
COPY . $GOPATH/src/github.com/percona/pmm/
WORKDIR $GOPATH/src/github.com/percona/pmm/api-tests/

CMD make init run-race
CMD ["make", "init", "run-race"]

46 changes: 46 additions & 0 deletions api-tests/management/services/agent_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (C) 2023 Percona LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

package services

import (
"context"
"testing"
"time"

"github.com/AlekSi/pointer"
"github.com/stretchr/testify/require"

pmmapitests "github.com/percona/pmm/api-tests"
"github.com/percona/pmm/api/management/v1/json/client"
mgmtSvc "github.com/percona/pmm/api/management/v1/json/client/management_service"
)

func TestListAgentVersions(t *testing.T) {
ctx, cancel := context.WithTimeout(pmmapitests.Context, 30*time.Second)
t.Cleanup(func() { cancel() })

t.Run("PMM Agent needs no update", func(t *testing.T) {
listAgentVersionsOK, err := client.Default.ManagementService.ListAgentVersions(
&mgmtSvc.ListAgentVersionsParams{
Context: ctx,
})
require.NoError(t, err)
require.Len(t, listAgentVersionsOK.Payload.AgentVersions, 1)

expected := pointer.ToString(mgmtSvc.ListAgentVersionsOKBodyAgentVersionsItems0SeverityUPDATESEVERITYUPTODATE)
require.Equal(t, expected, listAgentVersionsOK.Payload.AgentVersions[0].Severity)
})
}
Loading

0 comments on commit 439e2fc

Please sign in to comment.