Skip to content

Commit c1ef593

Browse files
authored
Merge pull request #4 from stackabletech/feat/suites
Add support for test suites
2 parents 46eb918 + 28dea7a commit c1ef593

File tree

150 files changed

+4169
-224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+4169
-224
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Pylint
1+
name: Lint
22

33
on: [push]
44

@@ -14,14 +14,14 @@ jobs:
1414
uses: actions/setup-python@v3
1515
with:
1616
python-version: ${{ matrix.python-version }}
17-
- name: Install dependencies
17+
- name: Install lint dependencies
1818
run: |
1919
python -m pip install --upgrade pip
2020
pip install --editable .
2121
pip install '.[lint]'
22-
- name: Analysing the code with pylint
22+
- name: Analysing the code with ruff
2323
run: |
24-
pylint $(git ls-files '*.py')
24+
ruff check src/
2525
- name: Analysing the code with mypy
2626
run: |
27-
mypy --install-types --non-interactive $(git ls-files '*.py')
27+
mypy --install-types --non-interactive src/

.github/workflows/test.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Test
2+
3+
on: [push]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: ["3.10", "3.11"]
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v3
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
- name: Install test dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
pip install --editable .
21+
- name: Run unit tests
22+
run: |
23+
python -m unittest discover -v -s src/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
build
33
dist
44
src/beku_stackabletech.egg-info
5+
examples/suites/tests/_work

.pre-commit-config.yaml

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,41 @@ repos:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
10+
exclude: examples/
1011
- id: check-added-large-files
1112
- repo: https://github.com/Yelp/detect-secrets
1213
rev: v1.4.0
1314
hooks:
1415
- id: detect-secrets
16+
exclude: examples/
1517
- repo: https://github.com/pre-commit/mirrors-autopep8
1618
rev: v2.0.1
1719
hooks:
1820
- id: autopep8
1921
entry: autopep8
20-
- repo: local
21-
# These hooks are run from the local virtual env (and it's assumed they are there)
22-
# to allow these tools to find project dependencies.
22+
- repo: https://github.com/astral-sh/ruff-pre-commit
23+
# Ruff version.
24+
rev: v0.0.275
25+
hooks:
26+
- id: ruff
27+
- repo: https://github.com/pre-commit/mirrors-mypy
28+
rev: 'v1.4.0'
2329
hooks:
24-
- id: pylint
25-
name: pylint
26-
entry: pylint
27-
language: system
28-
types: [ python ]
2930
- id: mypy
30-
name: mypy
31-
entry: mypy
32-
language: system
33-
types: [ python ]
3431
args: ['--install-types', '--non-interactive']
32+
additional_dependencies:
33+
- "Jinja2>=3.1.2"
34+
- "PyYAML>=6.0"
35+
exclude: examples/
36+
- repo: local
37+
hooks:
38+
- id: unittest
39+
name: unittest
40+
entry: python -m unittest discover -v -s src/
41+
additional_dependencies:
42+
- "Jinja2>=3.1.2"
43+
- "PyYAML>=6.0"
44+
language: python
45+
'types': [python]
46+
pass_filenames: false
47+
stages: [commit]

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
- Add support for Kuttl test suites and improve CI ([#4])
8+
9+
[#4]: https://github.com/stackabletech/beku.py/pull/4)
10+
711
## [0.0.6] - 2023-06-21
812

913
- Install and run pylint and mypy.
@@ -33,7 +37,8 @@ All notable changes to this project will be documented in this file.
3337

3438
### Changed
3539

36-
- Enable `trim_blocks` when processing Jinja templates to avoid spurious new lines. These can lead to broken shell commands.
40+
- Enable `trim_blocks` when processing Jinja templates to avoid spurious new lines. These can lead to broken shell
41+
commands.
3742

3843
## [0.0.1] - 2022-12-20
3944

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Version: 0.0.7-dev
1212
rm -rf tests/_work && beku
1313
cd tests/_work && kubectl kuttl test
1414

15+
Also see the `examples` folder.
16+
1517
## Description
1618

1719
Fast Kuttl tests expander for Stackable integration tests.
@@ -29,6 +31,7 @@ Update the version in:
2931
Update the CHANGELOG.
3032
Commit and tag.
3133
Build and publish:
34+
3235
rm -rf dist/
3336
python -m build --wheel .
3437
twine upload dist/*

examples/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Configuration Examples
2+
3+
This folder contains configuration examples for Beku.
4+
5+
## Test Suites
6+
7+
Test suites are an optional property of the `test-definition.yaml` file. If no test suite is explicitly defined,
8+
a `default` test suite is generated that selects all test definitons without patching any dimensions.
9+
10+
The folder `suites` contains an example on how to configure test suites.
11+
12+
The file `suites/test/test-definition.yaml` shows example configurations for two test suites:
13+
14+
suites:
15+
- name: latest # this suite will set all dimension values to the latest (last) value
16+
patch:
17+
- dimensions:
18+
- expr: last
19+
- name: smoke # this suite will only select the smoke tests
20+
select:
21+
- smoke
22+
23+
The `latest` suite will execute all tests only with the latest versions of each dimension.
24+
The `smoke` suite will expand only the `smoke` tests and ignore all others.
25+
26+
To select which suite to expand, use the --suite command line argument. For example:
27+
28+
cd examples/suites
29+
rm -rf tests/_work
30+
beku --suite latest
31+
32+
will generate the test cases for the `latest` suite.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestSuite
4+
testDirs:
5+
{% for testcase in testinput.tests %}
6+
- ./tests/{{ testcase.name }}
7+
{% endfor %}
8+
9+
startKIND: false
10+
suppress: ["events"]
11+
parallel: 2

examples/suites/tests/templates/.gitkeep

Whitespace-only changes.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
metadata:
5+
name: test-airflow-postgresql
6+
timeout: 480
7+
---
8+
apiVersion: apps/v1
9+
kind: StatefulSet
10+
metadata:
11+
name: airflow-postgresql
12+
status:
13+
readyReplicas: 1
14+
replicas: 1

0 commit comments

Comments
 (0)