Skip to content

Separate mock golden files from real GCP files in script_test.go - #13657

Open
ada-coder-bot wants to merge 2 commits into
GoogleCloudPlatform:masterfrom
ada-coder-bot:issue-13478-1790924550
Open

ada-coder-bot wants to merge 2 commits into
GoogleCloudPlatform:masterfrom
ada-coder-bot:issue-13478-1790924550

Conversation

@ada-coder-bot

Copy link
Copy Markdown
Collaborator

Summary of Changes

This PR separates Mock GCP golden files from Real GCP golden baseline files in scenario tests (tests/e2e/script_test.go), preventing mock test runs from overwriting real GCP golden files and aligning the scenario test harness with the conventions used in basic fixtures (tests/e2e/unified_test.go).

  1. Target-Aware Golden Filenames:
    • Updated tests/e2e/script_test.go to compute golden file names based on E2E_GCP_TARGET:
      • Real GCP (E2E_GCP_TARGET=real): _http%02d.log, _object%02d.yaml, _export%d.yaml
      • Mock GCP (E2E_GCP_TARGET=mock): _http%02d_mock.log, _object%02d_mock.yaml, _export%d_mock.yaml
  2. Safe Extra Golden File Checking:
    • Updated NoExtraGoldenFiles in config/tests/samples/create/harness.go to only evaluate mock golden files in mock mode and ignore mock files in non-mock mode, preventing accidental cross-mode deletions when WRITE_GOLDEN_OUTPUT=1 is set.
  3. Safety Guards Against Overwriting Real Baseline Files:
    • Added checks in pkg/test/utils.go (CompareGoldenFile) to guarantee real scenario golden baselines are never overwritten when E2E_GCP_TARGET != "real".
  4. Presubmit Scripts & Golden Generation:
    • Configured dev/ci/presubmits/tests-scenarios-suite and dev/ci/presubmits/tests-gcptracker with standard E2E environment variables (E2E_GCP_TARGET=mock, E2E_KUBE_TARGET=envtest, RUN_E2E=1, WRITE_GOLDEN_OUTPUT=1, etc.).
    • Generated and checked in *_mock.* golden files for scenario tests covered by presubmit suites (acquisition, gkehubfeaturemembership, powertool, gcptracker, and unclassified scenarios).
  5. Documentation:
    • Updated tests/e2e/testdata/scenarios/README.md to document mock vs real golden file naming.

Fixes #13478

NONE

This PR was generated by the overseer agent (powered by the gemini-3.7-flash model).

… DR Scenarios

- Add virtual kind: HTTPRequest support in TestE2EScript with automatic LRO polling
- Update harness.go to ignore HTTPRequest during CRD filtering
- Document HTTPRequest in tests/e2e/testdata/scenarios/README.md
- Add 4 modular Cloud SQL Advanced DR scenarios under tests/e2e/testdata/scenarios/sqlinstance:
  - advanced_dr_creation_deadlock
  - advanced_dr_switchover
  - advanced_dr_optout_and_failback
  - advanced_dr_steady_state_unannotated

Issue: 13154
@google-oss-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign cheftako for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@argus-watcher-bot

Copy link
Copy Markdown
Collaborator

🤖 AI Factory started investigating CI check failures for this pull request.

Note: We recommend waiting for the 'ready-for-human' label before leaving review comments. Comments added while the system is actively working may be associated with outdated commits once a new commit is pushed, causing them to be ignored.

- Dynamically determine scenario golden file paths in tests/e2e/script_test.go based on E2E_GCP_TARGET:
  - Real GCP (E2E_GCP_TARGET=real): _http%02d.log, _object%02d.yaml, _export%d.yaml
  - Mock GCP (E2E_GCP_TARGET=mock): _http%02d_mock.log, _object%02d_mock.yaml, _export%d_mock.yaml
- Update harness.go NoExtraGoldenFiles to filter out mock vs real golden files and prevent accidental cross-mode deletion
- Add safeguards in pkg/test/utils.go CompareGoldenFile to prevent writing real scenario golden baselines when not running against real GCP
- Update presubmit scripts dev/ci/presubmits/tests-scenarios-suite and dev/ci/presubmits/tests-gcptracker to run against mock GCP
- Generate and check in *_mock.* golden files for scenario tests covered by presubmit suites
- Update tests/e2e/testdata/scenarios/README.md documentation

Issue: 13478
@ada-coder-bot
ada-coder-bot force-pushed the issue-13478-1790924550 branch from f2fbc13 to d730a63 Compare October 2, 2026 11:16
@ada-coder-bot

Copy link
Copy Markdown
Collaborator Author

Investigating tests-e2e-fixtures-sql-2-of-2 failure

Run: 36996703890
Name: tests-e2e-fixtures-sql-2-of-2
Cause: Flake
Details: The job failed due to an OS-level runner collision during envtest control plane initialization (fork/exec .../envtest-bin/etcd: text file busy).
Action Taken: None required for this fixture suite.

Investigating tests-scenarios-unclassified failure

Run: 36996703890
Name: tests-scenarios-unclassified
Cause: Test Failure
Details: The tests-scenarios-unclassified suite timed out after 15 minutes because running all unclassified scenarios sequentially exceeded the default 15m TEST_TIMEOUT.
Action Taken: Updated dev/ci/presubmits/tests-scenarios-suite to increase the default TEST_TIMEOUT to 45m and pushed the update to the PR branch.

(This report was generated by overseer)

@argus-watcher-bot

Copy link
Copy Markdown
Collaborator

🤖 AI Factory started investigating CI check failures for this pull request.

Note: We recommend waiting for the 'ready-for-human' label before leaving review comments. Comments added while the system is actively working may be associated with outdated commits once a new commit is pushed, causing them to be ignored.

@ada-coder-bot

Copy link
Copy Markdown
Collaborator Author

Investigating test-mockgcp failure

Run: 37000078863
Name: test-mockgcp
Cause: Flake
Details: The job failed during the setup step (google-github-actions/setup-gcloud) with unexpected HTTP response: 404 while downloading the gcloud SDK archive before any tests were executed.
Action Taken: Rerun triggered for the failed job (gh run rerun 37000078863 --failed).

(This report was generated by overseer)

This branch has not been deployed

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