diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml index fda77abea9..127efce141 100644 --- a/.github/workflows/api-tests.yml +++ b/.github/workflows/api-tests.yml @@ -94,6 +94,7 @@ jobs: container_name: pmm-agent_pmm-server environment: - PMM_DEBUG=1 + - ENABLE_TELEMETRY=0 - PERCONA_TEST_CHECKS_INTERVAL=10s - PERCONA_TEST_PLATFORM_ADDRESS=https://check-dev.percona.com - PERCONA_TEST_PLATFORM_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX diff --git a/api-tests/README.md b/api-tests/README.md index 6326034927..1561ddd6ce 100644 --- a/api-tests/README.md +++ b/api-tests/README.md @@ -1,6 +1,6 @@ # pmm-api-tests -API tests for PMM 2.x +API tests for PMM 3.x # Setup Instructions @@ -8,7 +8,7 @@ Make sure you have the latest Go version installed on your systems, execute the to set up API-tests in your local systems. 1. Run PMM Server. This can be done by running `make env-up` in the root (`pmm`) directory. -2. In the case below, `$PMM_SERVER_URL` should be replaced with a URL in format `http://USERNAME:PASSWORD@HOST`. For local development it's usually `http://admin:admin@127.0.0.1`. +2. Replace `$PMM_SERVER_URL` with a URL in format `http://USERNAME:PASSWORD@HOST`. For local development it's usually `http://admin:admin@127.0.0.1`. # Usage @@ -32,9 +32,9 @@ Run Docker container using the following command: docker run -e PMM_SERVER_URL=**pmm-server-url** IMAGENAME ``` -where `PMM_SERVER_URL` should be pointing to pmm-server. +where `PMM_SERVER_URL` should be pointing to a running PMM Server. -If pmm-server located locally: +If pmm-server is located locally: - Use --network=host while running docker container or add both containers to the same docker network. - Use the insecure url if you default to a self-generated certificate. @@ -43,5 +43,5 @@ If pmm-server located locally: All tests should follow these rules: -- Tests can work in parallel and in real system, so take into account that there might be records in database. -- Always revert changes made by test. +- Tests can work in parallel and on a real system, so take into account that there might be records in database. +- Always revert changes made by tests. diff --git a/api-tests/backup/backups_test.go b/api-tests/backup/backups_test.go index e3c9aa981d..2e346daade 100644 --- a/api-tests/backup/backups_test.go +++ b/api-tests/backup/backups_test.go @@ -146,10 +146,10 @@ func TestScheduleBackup(t *testing.T) { require.NotNil(t, backup) // Assert change - assert.Equal(t, body.Enabled, backup.Enabled) - assert.Equal(t, body.Name, backup.Name) - assert.Equal(t, body.Description, backup.Description) - assert.Equal(t, body.CronExpression, backup.CronExpression) + assert.Equal(t, pointer.GetBool(body.Enabled), backup.Enabled) + assert.Equal(t, pointer.GetString(body.Name), backup.Name) + assert.Equal(t, pointer.GetString(body.Description), backup.Description) + assert.Equal(t, pointer.GetString(body.CronExpression), backup.CronExpression) assert.Equal(t, "backup_folder", backup.Folder) _, err = client.RemoveScheduledBackup(&backups.RemoveScheduledBackupParams{ diff --git a/api-tests/pmm-api-tests-output.txt b/api-tests/pmm-api-tests-output.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/managed/services/grafana/client.go b/managed/services/grafana/client.go index 915f376083..c58f000130 100644 --- a/managed/services/grafana/client.go +++ b/managed/services/grafana/client.go @@ -447,12 +447,10 @@ func (c *Client) CreateAlertRule(ctx context.Context, folderName, groupName stri } if err := c.do(ctx, "POST", fmt.Sprintf("/api/ruler/grafana/api/v1/rules/%s", folderName), "", authHeaders, body, nil); err != nil { - if err != nil { - if cErr, ok := errors.Cause(err).(*clientError); ok { //nolint:errorlint - return status.Error(codes.InvalidArgument, cErr.ErrorMessage) - } - return err + if cErr, ok := errors.Cause(err).(*clientError); ok { //nolint:errorlint + return status.Error(codes.InvalidArgument, cErr.ErrorMessage) } + return err } return nil