testing: fix vault setup test's reliance on specific Raft index (#25806)

The test for `nomad setup vault` command expects a specific `CreateIndex` for the
job it creates. Any Raft write when a server comes up or establishes leadership
can cause this test to break. Interpolate the expected index as we've done for
other indexes on the job to make this test less brittle.

Ref: https://github.com/hashicorp/nomad-enterprise/pull/2673#issuecomment-2847619747
This commit is contained in:
Tim Gross
2025-05-02 14:30:10 -04:00
committed by GitHub
parent 21fd0bbb8a
commit da592ab1b7

View File

@@ -87,7 +87,7 @@ test default batch pending
expectedOut: fmt.Sprintf(`{
"JobsWithoutVaultIdentity": [
{
"CreateIndex": 10,
"CreateIndex": %d,
"Datacenters": [
"dc1"
],
@@ -111,7 +111,7 @@ test default batch pending
"OutdatedNodes": [],
"VaultTokens": null
}
`, *job.CreateIndex, *job.ModifyIndex, *job.SubmitTime),
`, *job.CreateIndex, *job.CreateIndex, *job.ModifyIndex, *job.SubmitTime),
},
{
name: "-check with -t",