Skip to content

roachtest: fix WaitForReady bugs#138977

Merged
craig[bot] merged 1 commit intocockroachdb:masterfrom
kyle-a-wong:fix_roachtest_waitForReady
Jan 13, 2025
Merged

roachtest: fix WaitForReady bugs#138977
craig[bot] merged 1 commit intocockroachdb:masterfrom
kyle-a-wong:fix_roachtest_waitForReady

Conversation

@kyle-a-wong
Copy link
Copy Markdown
Contributor

WaitForReady was not properly handling when the deadline of a timeout context was reached while waiting for the cluster to be ready. Previously, hitting the timeout would result in the roachtest running for 10 minutes until the whole test timed out. Now, WaitForReady respects when the timeutil.RunWithTimeout context times out.

Updated WaitForReady's checkReady func to use RoachtestHTTPClient's http client when making the call to GET /health?ready=1 instead of RoachtestHTTPClient's wrapper method. This wrapper method attempts to authenticate the user if no session id exists, but this endpoint doesn't require authentication so it doesnt need to use the wrapper method.

Fixes: #138143
Resolves: #136128
Epic: None
Release note: None

WaitForReady was not properly handling when the deadline
of a timeout context was reached while waiting for the
cluster to be ready. Previously, hitting the timeout
would result in the roachtest running for 10 minutes
until the whole test timed out. Now, WaitForReady
respects when the timeutil.RunWithTimeout context
times out.

Updated WaitForReady's checkReady func to use
RoachtestHTTPClient's http client when making the call
to GET /health?ready=1 instead of RoachtestHTTPClient's
wrapper method. This wrapper method attempts to
authenticate the user if no session id exists, but this
endpoint doesn't require authentication so it doesnt
need to use the wrapper method.

Fixes: cockroachdb#138143
Resolves: cockroachdb#136128
Epic: None
Release note: None
@kyle-a-wong kyle-a-wong requested a review from a team as a code owner January 13, 2025 20:51
@kyle-a-wong kyle-a-wong requested review from golgeek and herkolategan and removed request for a team January 13, 2025 20:51
@cockroach-teamcity
Copy link
Copy Markdown
Member

This change is Reviewable

@kyle-a-wong kyle-a-wong requested review from a team and xinhaoz and removed request for a team January 13, 2025 20:58
Copy link
Copy Markdown
Contributor

@DarrylWong DarrylWong left a comment

Choose a reason for hiding this comment

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

The function of DefaultHTTPClient is to add cookies for secure requests. If that's not needed then you can probably just get rid of it and use httputil.Get() directly?

@kyle-a-wong
Copy link
Copy Markdown
Contributor Author

The function of DefaultHTTPClient is to add cookies for secure requests. If that's not needed then you can probably just get rid of it and use httputil.Get() directly?

The roachtest http client also configures the TLS config:

	// Certificates created by roachprod start are not signed by
	// a verified root authority.
	roachtestHTTP.client.Transport = &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}

@DarrylWong
Copy link
Copy Markdown
Contributor

The roachtest http client also configures the TLS config

Yup, you're totally right 🤦 In my defense I only wrote that code so how was I supposed to know? 🙃

@kyle-a-wong
Copy link
Copy Markdown
Contributor Author

TFTR!

bors r+

@craig
Copy link
Copy Markdown
Contributor

craig bot commented Jan 13, 2025

@craig craig bot merged commit 2e25969 into cockroachdb:master Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants