Skip to content

PMM-7 API tests rework#5299

Open
maxkondr wants to merge 7 commits intov3from
PMM-7-API-tests-rework
Open

PMM-7 API tests rework#5299
maxkondr wants to merge 7 commits intov3from
PMM-7-API-tests-rework

Conversation

@maxkondr
Copy link
Copy Markdown
Contributor

@maxkondr maxkondr commented Apr 28, 2026

PMM-7

Link to the Feature Build: Percona-Lab/pmm-submodules#4329

The tests flakiness was caused by several reasons:

  • tests didn't wait while Grafana inside PMM Server is fully up and running after all initializations and migrations
  • not all tests were idempotent
  • api-tests/server/settings tests update PMM Server configuration that triggers Grafana restart -> other tests fail while Grafata is unavailable.

Improvements:

  • Added test for RTA Mongodb Agent.
  • api-tests/server/settings has been separated from the rest of tests and is running at the end to avoid impact on the rest of tests
  • Make almost all tests running in parallel -> speedup test execution
  • Reworked Makefile - now there are targets to prepare and run tests.

Closes #2342.

The tests flakiness was caused by several reasons:
- tests didn't wait while Grafana inside PMM Server is fully up and running after all initializations and migrations
- not all tests were idempotent
- api-tests/server/settings tests update PMM Server configuration that triggers Grafana restart -> other tests fail while Grafata is unavailable.

Improvements:
- Added test for RTA Mongodb Agent.
- api-tests/server/settings has been separated from the rest of tests and is running at the end to avoid impact on the rest of tests
- Make almost all tests running in parallel -> speedup test execution
- Reworked Makefile - now there are targets to prepare and run tests.
reworked Makefile
@maxkondr maxkondr self-assigned this Apr 28, 2026
@maxkondr maxkondr requested a review from a team as a code owner April 28, 2026 14:16
@maxkondr maxkondr requested review from JiriCtvrtka and ademidoff and removed request for a team April 28, 2026 14:16
@maxkondr maxkondr changed the title Pmm 7 api tests rework PMM-7 API tests rework Apr 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.14%. Comparing base (b4e5544) to head (0d997ce).

Additional details and impacted files
@@            Coverage Diff             @@
##               v3    #5299      +/-   ##
==========================================
+ Coverage   41.49%   42.14%   +0.64%     
==========================================
  Files         410      410              
  Lines       41992    41992              
==========================================
+ Hits        17424    17696     +272     
+ Misses      22814    22512     -302     
- Partials     1754     1784      +30     
Flag Coverage Δ
admin 34.89% <ø> (ø)
agent 49.24% <ø> (+2.61%) ⬆️
managed 40.62% <ø> (+0.01%) ⬆️
vmproxy 72.09% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

InstanceID: "d752f1a9-31c9-4b8c-bb2d-d26bc000009",
NodeModel: "some-model",
Address: "some.example.rds",
Address: "some.example-1.rds",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come this field now takes a different value? Was it a buggy test?

Comment thread api-tests/Dockerfile
Comment on lines +9 to +11
ENV GONOPROXY='github.com/percona,github.com/Percona-Lab'
ENV GONOSUMDB='github.com/percona,github.com/Percona-Lab'
ENV GOPRIVATE='github.com/percona,github.com/Percona-Lab'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all of these? It worked without it before, looks like bloat.

Comment thread api-tests/Makefile

help: ## Show available targets
@echo "Available targets: $(TARGETS)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave out colors please, don't work well in all environments, especially in the logs (not human-readable).

Comment thread api-tests/Makefile

test-report: test ## Run tests and generate JUnit report
cat $(CURDIR)/$(TEST_OUTPUT_PREFIX)-*.txt | $(BIN_DIR)/go-junit-report > $(REPORT_OUT)
@echo "✅ Report is generated: $(REPORT_OUT)."
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@echo "✅ Report is generated: $(REPORT_OUT)."
@echo "✅ Report generated: $(REPORT_OUT)."

Just to make it consistent with the rest.

Comment thread api-tests/README.md

1. Run PMM Server. This can be done by running `make env-up` in the root (`pmm`) directory.
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`.
2. Replace `$PMM_SERVER_URL` with a URL in format `https://USERNAME:PASSWORD@HOST`. For local development it's usually `http://admin:admin@127.0.0.1`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Replace `$PMM_SERVER_URL` with a URL in format `https://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 `https://USERNAME:PASSWORD@HOST`. For local development it's usually `https://admin:admin@127.0.0.1`.

I think we don't really want to test http.

Comment thread api-tests/README.md

Precompile tests using the following command:
```
make -j4 init
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-j4 should probably be part of the target so the user doesn't have to remember the syntax.

@ademidoff
Copy link
Copy Markdown
Member

@maxkondr The trouble is that the snooze tests are not passing. PTAL

@maxkondr
Copy link
Copy Markdown
Contributor Author

@maxkondr The trouble is that the snooze tests are not passing. PTAL

Now passing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable paralleltest linter rule

2 participants