K8SPG 798 watch secrets unit test
CHANGE DESCRIPTION
Problem:
The Watching secrets envtest that we maintain is very flaky. When it is failing it requires someone to retrigger it until it passes.
The main reason for its failing is the assertions it performs for the reconcile count. In general we don't perform similar assertions to other parts of the codebase or in other operator (maybe I'm wrong here though). Also these assertions seem redundant for the test itself. So the proposal for this PR is to remove them completely since they are not reliable and relevant for the test scope.
We also noticed that for that particular test, we are not asserting the labels existence properly given that in its last scenario we are also removing the labels from the secret before updating it. With this PR, we add some checks for that as well.
Cause: Short explanation of the root cause of the issue if applicable.
Solution: Short explanation of the solution we are providing with this PR.
CHECKLIST
Jira
- [ ] Is the Jira ticket created and referenced properly?
- [ ] Does the Jira ticket have the proper statuses for documentation (
Needs Doc) and QA (Needs QA)? - [ ] Does the Jira ticket link to the proper milestone (Fix Version field)?
Tests
- [ ] Is an E2E test/test case added for the new feature/change?
- [ ] Are unit tests added where appropriate?
Config/Logging/Testability
- [ ] Are all needed new/changed options added to default YAML files?
- [ ] Are all needed new/changed options added to the Helm Chart?
- [ ] Did we add proper logging messages for operator actions?
- [ ] Did we ensure compatibility with the previous version or cluster upgrade process?
- [ ] Does the change support oldest and newest supported PG version?
- [ ] Does the change support oldest and newest supported Kubernetes version?
| Test name | Status |
|---|---|
| backup-enable-disable | passed |
| custom-extensions | passed |
| custom-tls | passed |
| demand-backup | passed |
| finalizers | passed |
| init-deploy | passed |
| monitoring | passed |
| monitoring-pmm3 | passed |
| one-pod | passed |
| operator-self-healing | passed |
| pitr | passed |
| scaling | passed |
| scheduled-backup | passed |
| self-healing | passed |
| sidecars | passed |
| start-from-backup | passed |
| tablespaces | passed |
| telemetry-transfer | passed |
| upgrade-consistency | passed |
| upgrade-minor | passed |
| users | passed |
| We run 21 out of 21 |
commit: https://github.com/percona/percona-postgresql-operator/pull/1183/commits/d312f171881fbc15aa38095a6613d7ce083b7588
image: perconalab/percona-postgresql-operator:PR-1183-d312f1718