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

Feat/operator workflow integration test #132

Merged
merged 26 commits into from
Oct 19, 2023

Conversation

yhaliaw
Copy link
Collaborator

@yhaliaw yhaliaw commented Oct 6, 2023

Overview

Convert to using operator workflow for integration tests

Rationale

Standardize the integration tests runs across charms repos.

Checklist

@yhaliaw yhaliaw added the trivial label Oct 6, 2023
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has totally checked 82 files.

Valid Invalid Ignored Fixed
36 1 45 0
Click to see the invalid file list
  • scripts/pre-integration-test.sh

scripts/pre-integration-test.sh Show resolved Hide resolved
yhaliaw and others added 12 commits October 6, 2023 11:05
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
* Remove catching of base exception

* Change random string generation method

* Add integration test of reconcile_interval

* Add reconcile interval test

* Update interval config

* Add test for update-interval

* Fix merge issues

* Update the status during checking of update

* Fix usage of wrong fixture

* Fix reconcile_interval and update_interval for juju 3.x

* Run apt-get clean on runner setup

* Add juju 3.x support

* Add juju 2.9 integration tests

* Fix workflow

* Fix juju 2.9 integration test

* Fix test

* Add module for tests of scheduled events

* Split deployment and spawning of runner in test fixture

* Debugging juju 2.9 integration tests

* Fix juju 3 and juju 2 support

* Update reconcile-interval test

* Fix support for juju 2 integration test

* Fix support for juju 2 integration test

* Fix waiting for juju 2 integration test

* Fix action wait

* Fix juju 2 support

* Fix missing key from no stdout returned

* Fix typo during refactor

* Fix type problem due to juju 2 and juju 3 difference

* Fix type issues

* Fix conflict between juju 2 and juju 3 test running in parallel on github

* Debug workflow

* Debug github action

* Restrict concurrency of GitHub workflow for integration tests

* Fix typo

* Fix juju app name

* Update documentation

* Rename assert_num_runners

* Add tox param for juju version

* Use matrix job for integration tests

* Fix formatting

* Fix support for juju 2 and juju 3 tox

* Enable running integration tests in parallel

* Add integration test for reconcile interval and update interval config (#97)

* Remove catching of base exception

* Add integration test of reconcile_interval and update_interval

* Run apt-get clean on runner setup

* Add juju 3.x support

* Add juju 2.9 integration tests

* Update jitter to random_delay

---------

Co-authored-by: Yanks Yoon <[email protected]>

* Configure Renovate (#24)

* Add renovate.json

* Do not require license for json files

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: arturo-seijas <[email protected]>
Co-authored-by: arturo-seijas <[email protected]>

* Resolve conflicts

* Allow integration test to be ran in parallel

* Test confined LXD container with microk8s

* Revert to unconfined mode for apparmor during e2e testing

* Add test for network access

* Add waiting for HTTP server to start up

* Load HTTP service via bash

* Fix github api changes

* Remove unneed file

* Fix command string

* Fix typing issue

* Check for return code of curl

---------

Co-authored-by: Yanks Yoon <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: arturo-seijas <[email protected]>
Co-authored-by: arturo-seijas <[email protected]>
* Remove LXD profile prior to retrying creating LXD instance

* Add missing docstring

* Add unit test

* Fix test

* Fix integration test

* Move integration test to test_charm.py

* Add retry for deletion of LXD profile

* debug

* Debug

* Fix removal of storage profile

* Fix bug

* Fix bug due to github api change

* Remove debug
* Add public interface

* Remove promtail prefix from fcts

* Fix license header

* Merge install and config into start

* Add interface to log metrics

* Add grafana_dashboard lib

* Move logging of event to metrics module

* Introduce charm state

* Update attrs doc

* Implement COS integration

* Remove grafana_dashboard

* Change proxy server settings in test_charm

* Ignore whitelist in pylintrc

* Add missing newlines

* Exclude woke.yaml from license check

* Add final newline to .woke.yaml

* Remove usage of requests.session in metrics

* Pin pydantic more specifically

* Fix type hint/doc string in ProxyConfig

* Pin pydantic

* Rename NotCompleteError

* Remove hardcoding of promtail arch

* Remove hardcoding of promtail arch

* Rename -> download_info

* promtail.start -> promtail.setup

* handle non-happy case first in metrics

* Remove group

* Adapt promtail.yaml.j2

* Introduce constant in test_charm

* Move issue_metrics to RunnerManagerConfig

* Fix promtail.service.j2

* Capture time only when needed

* Narrow the exception catch

* Introduce constants in Promtail

* Retry Promtail health check and raise error

* Use Path.write_bytes in promtail

* set unit status to Blocked for unhealthy promtail

* Fix integration test

Breaking change in latest Pygithub version

* Lint

* Catch RequestException

* Drop Promtail and call Loki directly

* Add unit test for charm state

* Switch to cos_agent integration

* Adapt integration test

* Fix integration test

* Simplify integration test

* Fix issue_event

* Add code to set up logrotate

* Update grafana dashboard

* Cleanup

* Remove status in wait_for_idle

* Small fixes

* Dont keep charm inside state

* Update src-docs

* Dont use mutable default value

* Compute event name on instantiation

* Raise LogrotateSetupError

* Reuse _create_runner func

* Check that metrics log is empty

* Fix docstring in Event

* Lint

* app_no_runner -> app
Copy link
Contributor

@merkata merkata left a comment

Choose a reason for hiding this comment

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

Looks good, I'm seeing @cbartz is working on #136 and has changes to the integration tests, worth considering when it gets merged (I assume it will get merged before this one).

@yhaliaw yhaliaw marked this pull request as ready for review October 17, 2023 06:06
@yhaliaw yhaliaw requested a review from a team as a code owner October 17, 2023 06:06
@github-actions
Copy link
Contributor

Test coverage for 7c3e140

Name                    Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------
src/charm.py              413     95     99     20    75%   80-82, 108-110, 142-144, 204-212, 224-228, 328-333, 354, 371-377, 386-409, 427-429, 437-440, 447, 450-451, 467, 472-477, 522->525, 538-539, 541-542, 576-583, 607-608, 620-622, 637-638, 663-664, 666-667, 669-670, 744->746, 806-807, 823, 841-843, 847
src/charm_state.py         12      0      2      0   100%
src/errors.py              24      0      0      0   100%
src/event_timer.py         42      8      4      0    74%   94-97, 117-120
src/firewall.py            43     25     10      0    38%   38-42, 64-67, 75-149
src/github_type.py         36      0      0      0   100%
src/lxd_type.py            37      0      2      0   100%
src/metrics.py             46      0     10      1    98%   60->63
src/runner.py             274     41     84     22    80%   38->42, 96->98, 192-199, 205-211, 254-263, 283-288, 293, 313, 317-327, 376->379, 382-384, 391, 405, 415, 419, 421, 436, 482-487, 497, 586, 621, 647, 652-664, 678, 698
src/runner_manager.py     235     26     90      9    88%   159, 216-218, 231-232, 244-246, 252-257, 261-262, 272-273, 292, 386, 406-410, 429, 447, 590, 610
src/runner_type.py         52      0     12      0   100%
src/utilities.py           68      6     20      8    84%   74->76, 78->84, 89-91, 117, 131, 169, 222
-------------------------------------------------------------------
TOTAL                    1282    201    333     60    81%

Static code analysis report

Run started:2023-10-18 06:36:43.839283

Test results:
  No issues identified.

Code scanned:
  Total lines of code: 2947
  Total lines skipped (#nosec): 0
  Total potential issues skipped due to specifically being disabled (e.g., #nosec BXXX): 9

Run metrics:
  Total issues (by severity):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
  Total issues (by confidence):
  	Undefined: 0
  	Low: 0
  	Medium: 0
  	High: 0
Files skipped (0):

Copy link
Collaborator

@arturo-seijas arturo-seijas left a comment

Choose a reason for hiding this comment

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

LGTM

@yhaliaw yhaliaw merged commit 8a3dc15 into main Oct 19, 2023
45 checks passed
@yhaliaw yhaliaw deleted the feat/operator-workflow-integration-test branch October 19, 2023 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants