MCPcopy Create free account
hub / github.com/github/gh-aw / TestUpdateCommand_OrgDryRunIntegration

Function TestUpdateCommand_OrgDryRunIntegration

pkg/cli/update_integration_test.go:459–490  ·  view source on GitHub ↗

--- Org Dry-Run Integration Tests --- TestUpdateCommand_OrgDryRunIntegration verifies that --org mode runs in dry-run (the default, without --create-pull-request or --create-issue) for two known repositories: github/gh-aw and github/gh-aw-firewall. The test validates that the command completes succe

(t *testing.T)

Source from the content-addressed store, hash-verified

457// the command completes successfully and produces well-formed output regardless
458// of whether the repos have pending updates.
459func TestUpdateCommand_OrgDryRunIntegration(t *testing.T) {
460 skipWithoutGitHubAuth(t)
461
462 setup := setupUpdateIntegrationTest(t)
463 defer setup.cleanup()
464
465 // Run update --org github targeting only gh-aw and gh-aw-firewall.
466 // No --create-pull-request or --create-issue flags → dry-run mode (default).
467 cmd := exec.Command(setup.binaryPath, "update",
468 "--org", "github",
469 "--repos", "gh-aw,gh-aw-firewall",
470 )
471 cmd.Dir = setup.tempDir
472 output, err := cmd.CombinedOutput()
473 outputStr := string(output)
474 t.Logf("Output:\n%s", outputStr)
475
476 require.NoError(t, err, "org dry-run should succeed: %s", outputStr)
477
478 // --org and --repos flags must be recognised.
479 assert.NotContains(t, outputStr, "unknown flag", "All flags should be recognized")
480
481 // The output must indicate one of the three valid terminal states:
482 // 1. Dry-run preview with pending updates listed.
483 // 2. All repos already up-to-date.
484 // 3. No repos with source-managed workflows found in the filtered set.
485 dryRunPreview := strings.Contains(outputStr, "Dry-run preview")
486 alreadyUpToDate := strings.Contains(outputStr, "up to date")
487 noReposFound := strings.Contains(outputStr, "No repositories")
488 assert.True(t, dryRunPreview || alreadyUpToDate || noReposFound,
489 "Output should indicate dry-run preview, up-to-date status, or no repos found; got: %s", outputStr)
490}
491
492// TestUpdateCommand_OrgSingleRepoDryRunIntegration verifies that --org mode can
493// target a single repository using --repos gh-aw and still complete in dry-run

Callers

nothing calls this directly

Calls 2

skipWithoutGitHubAuthFunction · 0.85

Tested by

no test coverage detected