Skip to content

Commit

Permalink
PMM-7: extract test env workaround (#2809)
Browse files Browse the repository at this point in the history
* extract test env workaround

* update client test

* update tests
  • Loading branch information
idoqo authored Feb 6, 2024
1 parent 3bb7ec4 commit 86b90a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/managed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,14 @@ jobs:
pushd tools && go mod download -x
popd && go mod download -x
- name: Initialize CI environment
run: make env-compose-up # the container workdir is /root/go/src/github.com/percona/pmm

- name: Launch PMM Server (see docker-compose.yml)
run: |
# Note: launching the container with --wait fails for an unknown reason.
# A temporary workaround is to run it manually. To be reverted once the issue is resolved.
# make env-compose-up # the container workdir is /root/go/src/github.com/percona/pmm
docker compose --profile pmm up -d
sleep 100s
docker logs pmm-server
- name: Restore Go build cache
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
continue-on-error: true
Expand Down
4 changes: 2 additions & 2 deletions managed/services/grafana/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestClient(t *testing.T) {
body := clientError.Body
body = strings.ReplaceAll(body, "\n", "") // different grafana versions format response differently
body = strings.ReplaceAll(body, " ", "") // so we cleanup response from spaces and newlines to get unified result
assert.Equal(t, "{\"message\":\"Unauthorized\"}", body)
assert.Equal(t, "{\"extra\":null,\"message\":\"Unauthorized\",\"messageId\":\"auth.unauthorized\",\"statusCode\":401,\"traceID\":\"\"}", body)
assert.Equal(t, `Unauthorized`, clientError.ErrorMessage)
assert.Equal(t, none, role)
assert.Equal(t, "None", role.String())
Expand Down Expand Up @@ -211,7 +211,7 @@ func TestClient(t *testing.T) {
authorization := req.Header.Get("Authorization")
_, err = c.CreateAnnotation(ctx, nil, time.Now(), "", authorization)
require.ErrorContains(t, err, "failed to create annotation: clientError: POST http://127.0.0.1:3000/api/annotations -> 401")
require.ErrorContains(t, err, "invalid username or password")
require.ErrorContains(t, err, "Invalid username or password")
})
})

Expand Down

0 comments on commit 86b90a9

Please sign in to comment.