Skip to content

PMM-10278 postgres_exporter integration tests #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 70 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from 61 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
cbd7ace
add compatibility with old exporter
ritbl May 22, 2022
e4258fe
add docker compose and SSL serts
ritbl May 22, 2022
46b20fc
add tools
ritbl May 22, 2022
0dc3950
remove common-check_license
ritbl May 22, 2022
9b2058d
cleanup
ritbl May 22, 2022
8cbe0d6
change to manual mode
ritbl May 22, 2022
fe3a5dd
remove yamllint
ritbl May 22, 2022
318af7c
remove tip
ritbl May 22, 2022
074ad4a
add PG 13 and 14 to build matrix
ritbl May 22, 2022
ceb3788
add configs
ritbl May 22, 2022
60adc4c
up
ritbl May 24, 2022
675b953
style
ritbl May 24, 2022
f4f2499
cleanup
ritbl May 24, 2022
6082c4e
fix test
ritbl May 24, 2022
c18424f
style
ritbl May 27, 2022
c09bffd
style
ritbl May 27, 2022
d6f75c3
review request
ritbl May 27, 2022
c9adb32
mod tidy
ritbl Jun 3, 2022
7124736
revert DSN pg change
ritbl Jun 14, 2022
1e10c56
PMM-10278 Added pgexporter test skeleton
tshcherban Jul 27, 2022
ff67891
PMM-10278 Test update
tshcherban Jul 27, 2022
6eae185
PMM-10278 Test update
tshcherban Jul 27, 2022
fcafb6b
PMM-10278 Wrap error
tshcherban Jul 27, 2022
e290e04
PMM-10278 Add memory stats, add exporter extract from client binary
tshcherban Aug 5, 2022
2dfbe3b
PMM-10278 make postgres params configurable
tshcherban Aug 5, 2022
e2d34c8
PMM-10278 message amend
tshcherban Aug 5, 2022
7167fd3
PMM-10278 lint disable
tshcherban Aug 5, 2022
2b84c9d
PMM-10278 host move to const
tshcherban Aug 5, 2022
9c09625
PMM-10278 const update
tshcherban Aug 5, 2022
67c8399
PMM-9973 resolutions filtering fix
tshcherban Aug 19, 2022
1f46409
PMM-9973 resolutions filtering fix
tshcherban Aug 19, 2022
3cc042b
PMM-10278 Add makefile for tests prepare and running
tshcherban Aug 19, 2022
0f388cf
PMM-9973 resolutions filtering fix
tshcherban Aug 19, 2022
fa73ee0
PMM-9973 resolutions filtering fix
tshcherban Aug 19, 2022
43f7dd1
PMM-9973 lint disable
tshcherban Aug 19, 2022
6f7cdf3
Merge remote-tracking branch 'origin/PMM-9973-pg-exporter-resolutions…
tshcherban Aug 19, 2022
e1f0875
PMM-10278 Updated makefile to run tests locally
tshcherban Aug 28, 2022
596d4d7
PMM-10278 Build fix
tshcherban Aug 28, 2022
682e903
PMM-10278 Debug code remove
tshcherban Aug 28, 2022
2ba4152
PMM-10278 Add 'original' exporter binary
tshcherban Aug 29, 2022
2f83aab
PMM-10278 Add 'original' exporter binary to makefile
tshcherban Aug 29, 2022
ee201fe
PMM-10278 Add 'original' exporter binary to makefile
tshcherban Aug 29, 2022
56022d3
PMM-10278 Refactor
tshcherban Aug 29, 2022
8affd7f
PMM-10278 Add metrics test
tshcherban Aug 30, 2022
f1bfa39
PMM-10278 Refactor, add comments to Makefile
tshcherban Aug 30, 2022
e081348
PMM-10278 Debug code cleanup
tshcherban Aug 30, 2022
b3db609
PMM-10278 Readme update, add command to use exporter from local repo
tshcherban Aug 30, 2022
a44d524
PMM-10278 Add single command to prepare env from local repo
tshcherban Aug 30, 2022
f6aed88
PMM-10278 Tests reordered
tshcherban Aug 30, 2022
513ff30
PMM-10278 Assets reorder
tshcherban Aug 30, 2022
d67caae
PMM-10278 Path fix, test run fix
tshcherban Aug 30, 2022
5b0093b
PMM-10278 Debug code remove
tshcherban Aug 30, 2022
76187d8
PMM-10278 Filename move to const
tshcherban Aug 30, 2022
a94ae79
PMM-10278 Message details add
tshcherban Aug 30, 2022
ca64787
PMM-9973 add postgres collector to registry
tshcherban Aug 30, 2022
7065b7a
Merge remote-tracking branch 'origin/PMM-9973-pg-exporter-resolutions…
tshcherban Aug 30, 2022
588c2b1
PMM-9973 debug code remove
tshcherban Aug 30, 2022
6da0992
Merge remote-tracking branch 'origin/PMM-9973-pg-exporter-resolutions…
tshcherban Aug 30, 2022
99881df
PMM-10278 Tests reorganize
tshcherban Aug 30, 2022
da75328
PMM-10278 Remove dump func from tests
tshcherban Aug 30, 2022
579a90a
PMM-10278 Add resolutions tests
tshcherban Aug 30, 2022
6974dd9
Merge remote-tracking branch 'origin/main' into PMM-10278-pg-exporter…
tshcherban Sep 6, 2022
ae4962b
PMM-10278 go.mod fix
tshcherban Sep 6, 2022
f7c60c3
PMM-10278 Add high resolution test
tshcherban Sep 15, 2022
f794d61
PMM-10278 add high resolution test
tshcherban Sep 15, 2022
dfb5774
Update percona_tests/metrics_test.go
tshcherban Sep 21, 2022
e8e4a74
PMM-10278 Lint fix
tshcherban Oct 3, 2022
4bf07b9
PMM-10278 CommandName fix
tshcherban Oct 3, 2022
f73eecb
Merge remote-tracking branch 'origin/main' into PMM-10278-pg-exporter…
tshcherban Oct 3, 2022
e180346
PMM-10278 lint fix
tshcherban Oct 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 0 additions & 90 deletions .circleci/config.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/ISSUE_TEMPLATE/bug_report.md

This file was deleted.

5 changes: 0 additions & 5 deletions .github/ISSUE_TEMPLATE/config.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/ISSUE_TEMPLATE/feature_request.md

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Go

on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:

jobs:
test:
name: Test
strategy:
matrix:
go-version:
- 1.17
postgresql-image:
- postgres:10
- postgres:11
- postgres:12
- postgres:13
- postgres:14
runs-on: ubuntu-latest
# The environment this job references
environment:
name: CI
steps:
- name: Set up Go release
uses: percona-platform/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: percona-platform/checkout@v2
- name: Run checks
run: |
go build -modfile=tools/go.mod -o bin/golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
go build -modfile=tools/go.mod -o bin/reviewdog github.com/reviewdog/reviewdog/cmd/reviewdog
bin/golangci-lint run -c=.golangci-required.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-check
bin/golangci-lint run -c=.golangci.yml --out-format=line-number | env REVIEWDOG_GITHUB_API_TOKEN=${{ secrets.GITHUB_TOKEN }} bin/reviewdog -f=golangci-lint -level=error -reporter=github-pr-review
- name: Run Tests
run: |
sudo chown 999:999 testdata/ssl/server/*
sudo chmod 600 testdata/ssl/server/*
docker-compose up -d
make
make test
env:
POSTGRESQL_IMAGE: ${{ matrix.postgresql-image }}
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
git status
docker --version
docker-compose --version
docker-compose logs
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@
/.metrics.*.removed
/tools/src
/vendor
/percona_tests/assets/postgres_exporter
/percona_tests/assets/postgres_exporter_percona
/percona_tests/assets/metrics.new.txt
/percona_tests/assets/metrics.old.txt
/percona_tests/assets/metrics.names.new.txt
/percona_tests/assets/metrics.names.old.txt
22 changes: 1 addition & 21 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ endif
%: common-% ;

.PHONY: common-all
common-all: precheck style check_license lint yamllint unused build test
common-all: precheck style lint unused build test

.PHONY: common-style
common-style:
Expand All @@ -136,17 +136,6 @@ common-style:
exit 1; \
fi

.PHONY: common-check_license
common-check_license:
@echo ">> checking license header"
@licRes=$$(for file in $$(find . -type f -iname '*.go' ! -path './vendor/*') ; do \
awk 'NR<=3' $$file | grep -Eq "(Copyright|generated|GENERATED)" || echo $$file; \
done); \
if [ -n "$${licRes}" ]; then \
echo "license header checking failed:"; echo "$${licRes}"; \
exit 1; \
fi

.PHONY: common-deps
common-deps:
@echo ">> getting dependencies"
Expand Down Expand Up @@ -204,15 +193,6 @@ else
endif
endif

.PHONY: common-yamllint
common-yamllint:
@echo ">> running yamllint on all YAML files in the repository"
ifeq (, $(shell which yamllint))
@echo "yamllint not installed so skipping"
else
yamllint .
endif

# For backward-compatibility.
.PHONY: common-staticcheck
common-staticcheck: lint
Expand Down
2 changes: 1 addition & 1 deletion cmd/postgres_exporter/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (e *Exporter) discoverDatabaseDSNs() []string {
var dsnURI *url.URL
var dsnConnstring string

if strings.HasPrefix(dsn, "postgresql://") {
if strings.HasPrefix(dsn, "postgresql://") || strings.HasPrefix(dsn, "postgres://") {
var err error
dsnURI, err = url.Parse(dsn)
if err != nil {
Expand Down
Loading