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

Decide wait time for deleting session based on session lifetime and m… #4192

Merged
merged 1 commit into from
Sep 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions tests/config/deploy/deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ def run_old_sessions_are_deleted(session_id=@session_id)
session_id = deploy_and_activate_session_v2("#{CONFIG_DEPLOY_APPS}/app_c", session_id, 1339)

# Check that all sessions have been deleted, except the active one
wait_until_local_session_deleted(session_id_a)
wait_until_local_session_deleted(session_id_b)
wait_until_local_session_deleted(session_id_a, session_lifetime)
wait_until_local_session_deleted(session_id_b, session_lifetime)
assert_exists(session_id_c)

set_config_server_config()
Expand Down Expand Up @@ -529,11 +529,12 @@ def local_session_exists(session_id)
exitcode == "0"
end

def wait_until_local_session_deleted(session_id)
# SessionsMaintainer is set to run every minute (see call to write_default_config_server_config in setup())
def wait_until_local_session_deleted(session_id, session_lifetime)
session_exists = true
# Wait for some time longer than maintainer interval, since config server might not have observed that session has been deactivated on first run
190.times do |i|
# Wait for some time longer than max(session lifetime, maintainer interval (30 secs)), since config
# server might not have observed that session has been deactivated on first run
iterations = [session_lifetime * 2, 30].max
iterations.times do |i|
session_exists = local_session_exists(session_id)
break if !session_exists
sleep 1
Expand Down