Skip to content

Fix broken integration tests by stripping YAML comment header before assertions#4890

Merged
pelikhan merged 3 commits into
mainfrom
copilot/fix-broken-test-cases
Nov 26, 2025
Merged

Fix broken integration tests by stripping YAML comment header before assertions#4890
pelikhan merged 3 commits into
mainfrom
copilot/fix-broken-test-cases

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Nov 26, 2025

Two integration tests (TestTopLevelGitHubTokenPrecedence and TestNeutralToolsIntegration) were failing because they check that certain patterns don't appear in compiled YAML output, but the generated files now include a comment header containing the original frontmatter—which contains the exact strings being checked against.

Changes

  • pkg/testutil/tempdir.go: Add StripYAMLCommentHeader() helper that extracts only the actual YAML content, skipping leading comment lines
  • pkg/testutil/tempdir_test.go: Add unit tests for the new helper
  • pkg/workflow/*_integration_test.go: Update both failing tests to use the shared helper before performing string assertions

Example

// Before: matches strings in comment header (false positive)
if strings.Contains(yamlContent, "github-token: ${{ secrets.TOPLEVEL_PAT }}") {
    t.Error("...")
}

// After: checks only actual YAML content
yamlContentNoComments := testutil.StripYAMLCommentHeader(yamlContent)
if strings.Contains(yamlContentNoComments, "github-token: ${{ secrets.TOPLEVEL_PAT }}") {
    t.Error("...")
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

please fix the broken test cases on main: Failing tests:

TestTopLevelGitHubTokenPrecedence/safe-outputs_github-token_overrides_top-level
TestNeutralToolsIntegration


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
@Mossaka Mossaka marked this pull request as ready for review November 26, 2025 22:47
Copilot AI changed the title [WIP] Fix broken test cases on main branch Fix broken integration tests by stripping YAML comment header before assertions Nov 26, 2025
Copilot AI requested a review from Mossaka November 26, 2025 22:48
@pelikhan pelikhan merged commit 4e34ebc into main Nov 26, 2025
4 checks passed
@pelikhan pelikhan deleted the copilot/fix-broken-test-cases branch November 26, 2025 22:56
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