fix(test): Wait for Vault server in watch tests#2053
Open
thevilledev wants to merge 1 commit intohashicorp:mainfrom
Open
fix(test): Wait for Vault server in watch tests#2053thevilledev wants to merge 1 commit intohashicorp:mainfrom
thevilledev wants to merge 1 commit intohashicorp:mainfrom
Conversation
7901e87 to
6c43fdb
Compare
Contributor
Author
|
I was able to dig out the following from Vault (Enterprise) stdout: Looks like it needs to use ephemeral ports like the other tests. Will mark this as a draft for now. |
e42a153 to
bdf5fa4
Compare
Fix flaky tests by polling Vault's /v1/sys/health endpoint. This ensures the server is ready before tests attempt to connect, preventing a race condition during Vault dev server startup. Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
e6d0114 to
d323dc2
Compare
Contributor
Author
|
Now There's very little to debug due to consul output being omitted. My only hunch is that maybe the Consul Enterprise license in Maybe someone from HashiCorp could verify. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix flaky tests by polling Vault's
/v1/sys/healthendpoint. This ensures the server is ready before tests attempt to connect, preventing a race condition during Vault dev server startup.Example of a failed run: https://github.com/hashicorp/consul-template/actions/runs/14620430375/job/41018777729?pr=2052
Breakdown of the issue in
watch/watch_test.go:maincallsnewTestVault()to start a Vault dev server usingexec.Command("vault", "server", "-dev", ...)and stores the command intestVault.cmd.Start(),maincreates Vault clients and callsvaultTokenSetup(clients).vaultTokenSetupthen attempts to communicate with the Vault API throughvc.Sys().EnableAuthWithOptions(...), which fails with the connection refused error as the process is not in listening state yet.Seems to affect the Enterprise tests more than the others.
You can simulate the test error locally by making the test launch an intermediate script which sleeps indefinitely.