Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: ensure reset_gitlab() succeeds#1783

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nejch merged 1 commit intomainfromjlvillal/sidekiq
Dec 29, 2021
Merged

chore: ensure reset_gitlab() succeeds#1783

nejch merged 1 commit intomainfromjlvillal/sidekiq
Dec 29, 2021

Conversation

JohnVillalovos
Copy link
Member

@JohnVillalovosJohnVillalovos commentedDec 28, 2021
edited
Loading

Ensure reset_gitlab() succeeds by waiting to make sure everything has
been deleted as expected. If the timeout is exceeded fail the test.

Not usingwait_for_sidekiq as it didn't work. During testing I
didn't see any sidekiq processes as being busy even though not
everything was deleted.

@JohnVillalovosJohnVillalovos marked this pull request as draftDecember 28, 2021 04:46
@JohnVillalovosJohnVillalovosforce-pushed thejlvillal/sidekiq branch 4 times, most recently fromabfcb9e tofa2b2c1CompareDecember 28, 2021 09:19
@JohnVillalovosJohnVillalovos changed the titlechore: update 'wait_for_sidekiq' function & use it morechore: testing/experimentingDec 28, 2021
@JohnVillalovosJohnVillalovos changed the titlechore: testing/experimentingchore: ensure reset_gitlab() succeedsDec 28, 2021
@JohnVillalovosJohnVillalovosforce-pushed thejlvillal/sidekiq branch 2 times, most recently from112f07f toc9243baCompareDecember 28, 2021 18:31
@JohnVillalovosJohnVillalovos marked this pull request as ready for reviewDecember 28, 2021 18:49
@JohnVillalovosJohnVillalovos marked this pull request as draftDecember 28, 2021 22:36
@JohnVillalovosJohnVillalovos marked this pull request as ready for reviewDecember 28, 2021 22:37
Comment on lines 42 to 61
defwait_for_list_empty(
rest_manager:gitlab.base.RESTManager,description:str
)->None:
"""Wait for the list() to become empty or fail test if timeout is exceeded"""
for_inrange(max_iterations):
ifrest_manager.list()== []:
break
time.sleep(SLEEP_INTERVAL)
assertrest_manager.list()== [], (
f"Did not delete all{description}. "
f"Elapsed_time:{time.perf_counter()-start_time}"
)

wait_for_list_empty(rest_manager=gl.projects,description="projects")
wait_for_list_empty(rest_manager=gl.groups,description="groups")
wait_for_list_empty(rest_manager=gl.variables,description="variables")

for_inrange(max_iterations):
iflen(gl.users.list())<=1:
break
time.sleep(SLEEP_INTERVAL)
assert [user.usernameforuseringl.users.list()]== ["root"], (
f"Did not delete all users. "
f"elapsed_time:{time.perf_counter()-start_time}"
)
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for this! Can we even just not care about the root user specifics and use the same helper for both cases e.g. something like this (not sure what to name it then 😀 ):

(not sure if I missed something)

Suggested change
defwait_for_list_empty(
rest_manager:gitlab.base.RESTManager,description:str
)->None:
"""Wait for the list() to become empty or fail test if timeout is exceeded"""
for_inrange(max_iterations):
ifrest_manager.list()== []:
break
time.sleep(SLEEP_INTERVAL)
assertrest_manager.list()== [], (
f"Did not delete all{description}. "
f"Elapsed_time:{time.perf_counter()-start_time}"
)
wait_for_list_empty(rest_manager=gl.projects,description="projects")
wait_for_list_empty(rest_manager=gl.groups,description="groups")
wait_for_list_empty(rest_manager=gl.variables,description="variables")
for_inrange(max_iterations):
iflen(gl.users.list())<=1:
break
time.sleep(SLEEP_INTERVAL)
assert [user.usernameforuseringl.users.list()]== ["root"], (
f"Did not delete all users. "
f"elapsed_time:{time.perf_counter()-start_time}"
)
defwait_for_list_empty(
rest_manager:gitlab.base.RESTManager,description:str,length:int=0
)->None:
"""Wait for the list() to have required length or fail test if timeout is exceeded"""
for_inrange(max_iterations):
iflen(rest_manager.list())<=length:
break
time.sleep(SLEEP_INTERVAL)
assertlen(rest_manager.list())<=length, (
f"Did not delete all{description}. "
f"Elapsed_time:{time.perf_counter()-start_time}"
)
wait_for_list_empty(rest_manager=gl.projects,description="projects")
wait_for_list_empty(rest_manager=gl.groups,description="groups")
wait_for_list_empty(rest_manager=gl.variables,description="variables")
wait_for_list_empty(rest_manager=gl.users,description="users",length=1)

JohnVillalovos reacted with thumbs up emoji
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Looks nice. I will do that. Now which PR do we think will land first? Because the 2nd PR to land will need to be rebased.

Copy link
Member

Choose a reason for hiding this comment

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

This seems like a smaller change so I'd go with this one unless you think it'll be a very tedious rebase on the other one 😁

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

This seems like a smaller change so I'd go with this one unless you think it'll be a very tedious rebase on the other one 😁

Works for me. Order doesn't matter for difficulty I believe.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Also I think this one is better to go first. Should make other one cleaner in not needing to touchwait_for_sidekiq code.

Ensure reset_gitlab() succeeds by waiting to make sure everything hasbeen deleted as expected. If the timeout is exceeded fail the test.Not using `wait_for_sidekiq` as it didn't work. During testing Ididn't see any sidekiq processes as being busy even though noteverything was deleted.
@nejchnejch merged commitf26bf7d intomainDec 29, 2021
@nejchnejch deleted the jlvillal/sidekiq branchDecember 29, 2021 00:13
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@nejchnejchnejch left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@JohnVillalovos@nejch

[8]ページ先頭

©2009-2025 Movatter.jp