Skip to content

Commit 974c0d1

Browse files
committed
Update test readme and small fixes
1 parent 70d4f06 commit 974c0d1

5 files changed

Lines changed: 250 additions & 185 deletions

File tree

e2e-tests/README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,65 @@ Test execution produces excessive output. It is recommended to redirect the outp
121121
./e2e-tests/run >> /tmp/tests-run.out 2>&1
122122
```
123123

124+
## Python development setup
125+
126+
The e2e tests are being migrated to pytest. This section covers setting up the Python environment.
127+
128+
### Installing uv
129+
130+
[uv](https://github.com/astral-sh/uv) is used for Python dependency management. Install it via make:
131+
132+
```
133+
make uv
134+
```
135+
136+
Or manually:
137+
138+
```
139+
curl -LsSf https://astral.sh/uv/install.sh | sh
140+
```
141+
142+
### Python make targets
143+
144+
```
145+
make py-deps # Install Python dependencies (locked versions)
146+
make py-update-deps # Update Python dependencies
147+
make py-fmt # Format code and organize imports with ruff
148+
make py-check # Run ruff linter and mypy type checks
149+
```
150+
151+
### Running tests with pytest
152+
153+
First, install dependencies:
154+
155+
```
156+
make py-deps
157+
```
158+
159+
Run all pytest-based tests:
160+
161+
```
162+
uv run pytest e2e-tests/
163+
```
164+
165+
Run a specific test file:
166+
167+
```
168+
uv run pytest e2e-tests/init-deploy/test_init_deploy.py
169+
```
170+
171+
Run a specific test:
172+
173+
```
174+
uv run pytest e2e-tests/init-deploy/test_init_deploy.py::TestInitDeploy::test_cluster_creation
175+
```
176+
177+
Run tests matching a pattern:
178+
179+
```
180+
uv run pytest e2e-tests/ -k "init"
181+
```
182+
124183
## Using environment variables to customize the testing process
125184

126185
### Re-declaring default image names
@@ -129,7 +188,7 @@ You can use environment variables to re-declare all default images used for test
129188
full list of variables is the following one:
130189

131190
* `IMAGE` - Percona Server for MongoDB Operator, `perconalab/percona-server-mongodb-operator:main` by default,
132-
* `IMAGE_MONGOD` - mongod, `perconalab/percona-server-mongodb-operator:main-mongod4.4` by default,
191+
* `IMAGE_MONGOD` - mongod, `perconalab/percona-server-mongodb-operator:main-mongod8.0` by default,
133192
* `IMAGE_PMM_CLIENT` - Percona Monitoring and Management (PMM) client, `perconalab/pmm-client:dev-latest` by default,
134193
* `IMAGE_BACKUP` - backup, `perconalab/percona-server-mongodb-operator:main-backup` by default,
135194

e2e-tests/conftest.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ def test_paths(request: pytest.FixtureRequest) -> Dict[str, str]:
8989
conf_dir = test_dir.parent / "conf"
9090
src_dir = test_dir.parent.parent
9191

92-
return {"test_file": str(test_file), "test_dir": str(test_dir), "conf_dir": str(conf_dir), "src_dir": str(src_dir)}
92+
return {
93+
"test_file": str(test_file),
94+
"test_dir": str(test_dir),
95+
"conf_dir": str(conf_dir),
96+
"src_dir": str(src_dir),
97+
}
9398

9499

95100
@pytest.fixture(scope="class")
@@ -451,9 +456,9 @@ def deploy_minio() -> None:
451456
"--",
452457
"bash",
453458
"-c",
454-
"AWS_ACCESS_KEY_ID=some-access-key"
455-
"AWS_SECRET_ACCESS_KEY=some-secret-key"
456-
"AWS_DEFAULT_REGION=us-east-1"
459+
"AWS_ACCESS_KEY_ID=some-access-key "
460+
"AWS_SECRET_ACCESS_KEY=some-secret-key "
461+
"AWS_DEFAULT_REGION=us-east-1 "
457462
f"/usr/bin/aws --no-verify-ssl --endpoint-url {endpoint} s3 mb s3://{bucket}",
458463
)
459464

e2e-tests/lib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

e2e-tests/lib/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def clean_all_namespaces() -> None:
281281
]
282282

283283
if namespaces:
284-
subprocess.Popen(["kubectl", "delete", "ns"] + namespaces)
284+
kubectl_bin("delete", "ns", *namespaces)
285285
except subprocess.CalledProcessError:
286286
logger.error("Failed to clean namespaces")
287287

0 commit comments

Comments
 (0)