Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
PMM-9780 Update tests after VM update (#1094)
Browse files Browse the repository at this point in the history
* PMM-9780 Update tests after VM update

* PMM-9780 Fix linter warning

* PMM-9780 Improve CI
  • Loading branch information
artemgavrilov authored Apr 26, 2022
1 parent 230f3ea commit 0507e47
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,21 +188,19 @@ jobs:
go run .github/check-license.go
bin/go-sumtype ./...
# use GITHUB_TOKEN because only it has access to GitHub Checks API
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | bin/reviewdog -f=golangci-lint -name='Required checks' -reporter=github-pr-check
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | bin/reviewdog -f=golangci-lint -reporter=github-pr-review -fail-on-error=true
# run it like that until some of those issues/PRs are resolved:
# * https://github.com/quasilyte/go-consistent/issues/33
# run it like this until it will be added to golangci-lint:
# * https://github.com/golangci/golangci-lint/issues/288
# * https://github.com/reviewdog/errorformat/pull/47 (once it is atually used by reviewdog)
bin/go-consistent -pedantic -exclude "tests" ./... | bin/reviewdog -f=go-consistent -name='Required go-consistent checks' -reporter=github-pr-check
bin/go-consistent -pedantic -exclude "tests" ./... | bin/reviewdog -f=go-consistent -reporter=github-pr-review -fail-on-error=true
- name: Run optional checks/linters
run: |
# use ROBOT_TOKEN for better reviewer's name
if [[ ! -z "${{ secrets.ROBOT_TOKEN }}" ]]; then
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.ROBOT_TOKEN }} bin/reviewdog -f=golangci-lint -name='Linters' -reporter=github-pr-review
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.ROBOT_TOKEN }} bin/reviewdog -f=golangci-lint -reporter=github-pr-review
else
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -name='Linters' -reporter=github-pr-review
bin/golangci-lint run --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -reporter=github-pr-review
fi
- name: Check that there are no source code changes
Expand Down
16 changes: 10 additions & 6 deletions services/victoriametrics/victoriametrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ import (
"github.com/AlekSi/pointer"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
"gopkg.in/reform.v1"
"gopkg.in/reform.v1/dialects/postgresql"

"github.com/percona/pmm-managed/models"
"github.com/percona/pmm-managed/utils/testdb"
"github.com/percona/pmm-managed/utils/tests"
)

const configPath = "../../testdata/victoriametrics/promscrape.yml"
Expand Down Expand Up @@ -755,19 +758,20 @@ scrape_configs:
assert.Errorf(t, err, "error when checking Prometheus config")
})

t.Run("Good scrape config file with unsupported params", func(t *testing.T) {
t.Run("Scrape config file with unknown params", func(t *testing.T) {
err := svc.configAndReload(context.TODO(), []byte(strings.TrimSpace(`
# Managed by pmm-managed. DO NOT EDIT.
---
global:
scrape_interval: 1m
scrape_timeout: 54s
remote_write:
- url: http://some-remote-url
remote_read:
- url: http://some-remote-read-url
unknown_filed: unknown_value
`)))
assert.NoError(t, err)
tests.AssertGRPCError(t, status.New(codes.Aborted,
"yaml: unmarshal errors:\n line 6: field unknown_filed not found in type promscrape.Config;"+
" pass -promscrape.config.strictParse=false command-line flag for ignoring unknown fields in yaml config\n",
), err)
})
}

Expand Down

0 comments on commit 0507e47

Please sign in to comment.