Skip to content

test: stop withViper pinning keys for later tests - #1164

Merged
cdalar merged 1 commit into
mainfrom
test/withviper-cleanup
Oct 4, 2026
Merged

cdalar merged 1 commit into
mainfrom
test/withviper-cleanup

Conversation

@cdalar

@cdalar cdalar commented Oct 4, 2026

Copy link
Copy Markdown
Owner

Fixes main's build, which has failed intermittently since 2026-10-02. This was meant to be part of #1158, but that PR was merged before this commit was pushed.

  • Cause: withViper, in cmd/root_provider_test.go, restored a key with viper.Set(key, orig). That leaves a permanent override in viper's highest-priority layer.
  • Effect: under -shuffle=on, when a root_provider test runs before TestCreateFlagsBindToViper, --fc-binary can no longer change fc.binPath, and the test fails (expected "/usr/local/bin/firecracker", actual "firecracker").
  • Fix: the cleanup does viper.Set(key, nil) instead. Viper skips a nil override and falls through to flags, config and defaults.
  • Verified locally: an empty HOME (as on CI) with -shuffle seeds 1–12; seeds 3 and 6 failed before the fix and pass now. The full go test -race -shuffle=on ./... is clean.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4

Its cleanup restored a key with viper.Set(key, orig), which leaves an
override -- the highest-priority layer -- holding the old value for
the rest of the package's tests. Under -shuffle, when a root_provider
test ran before TestCreateFlagsBindToViper, --fc-binary could no longer
change fc.binPath and the build failed (main has been red since
2026-10-02). Clear the override with a nil Set instead, which viper
skips in favour of flags, config and defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U8g3mHkS6JmtYVYc4AjcV4
(cherry picked from commit 3e8d98c)
@cdalar
cdalar enabled auto-merge (squash) October 4, 2026 16:38
@cdalar
cdalar merged commit ef06d43 into main Oct 4, 2026
12 checks passed
@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 36.93%. Comparing base (2f5cb90) to head (4c0dad9).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1164   +/-   ##
=======================================
  Coverage   36.93%   36.93%           
=======================================
  Files          51       51           
  Lines        5656     5656           
=======================================
  Hits         2089     2089           
  Misses       3567     3567           

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant

⌂ 捒网址