Skip to content

Conversation

@nsuma8989
Copy link

Update to tests to validate generated pipeline using pipeline upload dry run command

@nsuma8989 nsuma8989 requested a review from a team as a code owner December 15, 2025 07:17
Comment on lines +575 to +590

// --- New: validate generated pipeline with buildkite-agent dry-run ---
if _, err := exec.LookPath("buildkite-agent"); err == nil {
cmd := exec.Command(
"buildkite-agent",
"pipeline", "upload",
pipeline.Name(),
"--dry-run",
"--agent-access-token", "dummy",
)
out, err := cmd.CombinedOutput()
t.Log(string(out))
require.NoError(t, err, "Buildkite rejected generated YAML")
} else {
t.Log("buildkite-agent not installed; skipping dry-run validation")
}

Choose a reason for hiding this comment

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

This block is repeated in each test function. I would suggest creating a helper function that does this, and then just calling that from each test. That function could also potentially cover the case where you are using realAgent instead of buildkite-agent and then those other two tests can it as well. That makes the code easier to read and maintain :)

Copy link
Author

Choose a reason for hiding this comment

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

Good point @omehegan . I will make this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants