Skip to content

Optionally keep containers after running integration tests #1478

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

Merged
merged 7 commits into from
Jun 1, 2021
Merged

Optionally keep containers after running integration tests #1478

merged 7 commits into from
Jun 1, 2021

Conversation

benjamb
Copy link
Contributor

@benjamb benjamb commented May 27, 2021

While developing tests, waiting for a new GitLab container to spin up every run became a little frustrating, especially given I only wanted to run one file within the suite.

Added an optional flag which may be passed to pytest to keep the containers around after a test run.

Copy link
Member

@nejch nejch left a comment

Choose a reason for hiding this comment

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

Awesome @benjamb, we lost this when switching from the bash scripts as the cleanup fixture wasnt available in pytest-docker at the time. Was going to get to this but you beat me to it ;)

Just a few tiny comments. BTW, have you tried running the full suites (both API and CLI) a few times in a row to see if our tests actually clean up all resources for consistent results? The functional tests are still in kind of poor shape so I'm not sure. I'll try to play a bit later today but just checking. :) Thanks

Additionally updates token creation to make use of `first_or_create()`,
to avoid errors from the script caused by GitLab constraints preventing
duplicate tokens with the same value.
@benjamb
Copy link
Contributor Author

benjamb commented Jun 1, 2021

Just a few tiny comments. BTW, have you tried running the full suites (both API and CLI) a few times in a row to see if our tests actually clean up all resources for consistent results? The functional tests are still in kind of poor shape so I'm not sure. I'll try to play a bit later today but just checking. :) Thanks

I could have sworn I had, though after running the full API tests twice in a row I hit a few errors and have since included some additional fixes to address these on top of this PR.

benjamb added 6 commits June 1, 2021 15:09
This is a feature added in 3.8, removing it allows for the test to run
with lower python versions.
Deploy tokens would remain in the instance if the respective project or
group was deleted without explicitly revoking the deploy tokens first.
Was incorrectly using the issue 'id' vs 'iid'.
Timing issues between requesting group deletion and GitLab enacting that
deletion resulted in errors while attempting to delete a user which was
the sole owner of said group (see: test_groups). Pass the 'hard_delete'
parameter to ensure user deletion.
@nejch nejch merged commit d981956 into python-gitlab:master Jun 1, 2021
@benjamb benjamb deleted the benbrown/keep-containers branch June 2, 2021 07:46
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.

2 participants