Skip to content
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

Test coordinator #60

Merged
merged 8 commits into from
Aug 21, 2024
Merged

Conversation

MichaelThamm
Copy link
Contributor

@MichaelThamm MichaelThamm commented Aug 20, 2024

Issue

Coordinator is missing unit tests and pytest.fixtures

Solution

Added fixtures for a default working coordinator and some unit tests

Context

  • According to @lucabello the refactoring of the role_config in the Coordinator class should be tested using the HA charms to ensure no regression occurs.

Testing Instructions

tox -e unit -- tests/test_coordinated_workers/test_coordinator.py

1) Coordinator pytest fixtures
2) Coordinator unit tests
3) Minor refactoring of roles_config in coordinator.py
@MichaelThamm MichaelThamm requested a review from a team as a code owner August 20, 2024 19:16
src/cosl/coordinated_workers/coordinator.py Outdated Show resolved Hide resolved
src/cosl/coordinated_workers/coordinator.py Outdated Show resolved Hide resolved
tests/test_coordinated_workers/test_coordinator.py Outdated Show resolved Hide resolved
1) Cleanup the ClusterRolesConfig dataclass and the is_coherent property method.

2) Update the unit tests
1) Format
2) Create test_roles_config.py tests
3) Update the ClusterRolesConfig class
@MichaelThamm MichaelThamm merged commit 51e443f into coordinated-workers-tests Aug 21, 2024
@MichaelThamm MichaelThamm deleted the test-coordinator branch August 21, 2024 21:07
MichaelThamm added a commit that referenced this pull request Aug 22, 2024
* Added the following:
1) Coordinator pytest fixtures
2) Coordinator unit tests
3) Created test_roles_config.py tests

* Removed:
1) Coordinator.py changes due to lack of testing
PietroPasotti added a commit that referenced this pull request Aug 26, 2024
* Catch SecretNotFoundError when privkey shouldn't be here (#48)

* Catch SecretNotFoundError when privkey shouldn't be here

* Bring back if self.tls_available check from pre-refactor times

* lint

* Bump the version that was forgotten in #48 (#50)

* Add issues integration action (#52)

* Add issues integration action

* Order imports differently as lint started to complain

* Update databag model dump return value (#53)

* dump returns databag

* tests

* root ca cert patch

* fixed static checks

* fix

* removed conftest

* added health check logic to worker (#55)

* added health check logic to worker

* adapted status check to be less tempo-specific

* use regular paths for codespell too

* rerun black

* vbump

* added worker error on timeout if restart fails (#56)

* added worker error on timeout if restart fails

* maintenance status throughout retries

* fixed static

* only restart own services

* added tls support for worker checks (#59)

* added tls support for worker checks

* lint

* static fix

* Test coordinator (#60)

* Added the following:
1) Coordinator pytest fixtures
2) Coordinator unit tests
3) Rrefactoring of roles_config in coordinator.py
  * ClusterRolesConfig was switched to a dataclass with __post_init__ and is_coherent_with methods
4) Created test_roles_config.py tests

* Chore: Fix leftover comments and minor code changes

* * Updates
1) Fmt
2) Merged 'main:coordinator.py' into test-coordinator-cleanup to fix Secrets error

* Added docstrings to ClusterRoleConfig

---------

Co-authored-by: Mateusz Kulewicz <mateusz.kulewicz@canonical.com>
Co-authored-by: PietroPasotti <starfire.daemon@gmail.com>
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.

3 participants