TestPrepareSelectedCommandContext_RebindsTargetConfig and
_DoesNotMergeCallerConfigForUnsetKeys assert that a config.yaml actor is
rebound, but BEADS_ACTOR outranks config.yaml on purpose
(resolveConfiguredActor, the GH#4645 fix), and so does BD_ACTOR through
viper's BD-prefixed AutomaticEnv. Either one exported in a shell made the
assertion unsatisfiable. A new clearActorEnv helper blanks both, following
the t.Setenv("X", "") idiom these tests already use for the Dolt server env.
A full cmd/bd run with both variables set found a third:
TestCollectViperEntriesWithEnvOverride sets BD_ACTOR and expects it as the
reported source, but an exported BEADS_ACTOR wins. It now blanks
BEADS_ACTOR.
CI runners set neither variable, so all three only failed locally. No
product code changes.
Agent-Signature: claude-code-opus-5-5-unknown-reasoning on behalf of Harry Miller
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0eb46872c7
commit
06b3320a67
2 changed files with 18 additions and 0 deletions
|
|
@ -284,6 +284,9 @@ func TestCollectViperEntriesWithEnvOverride(t *testing.T) {
|
|||
defer os.Chdir(origDir) //nolint:errcheck
|
||||
|
||||
t.Setenv("BD_ACTOR", "env-bot")
|
||||
// BEADS_ACTOR outranks BD_ACTOR on purpose (GH#4645), so one exported in
|
||||
// the developer's shell would be reported as the source instead (GH#6560).
|
||||
t.Setenv("BEADS_ACTOR", "")
|
||||
t.Setenv("BEADS_TEST_IGNORE_REPO_CONFIG", "1")
|
||||
config.ResetForTesting()
|
||||
if err := config.Initialize(); err != nil {
|
||||
|
|
|
|||
|
|
@ -51,9 +51,23 @@ func restoreRootFlagState(t *testing.T, state map[string]flagSnapshot) {
|
|||
}
|
||||
}
|
||||
|
||||
// clearActorEnv blanks the two environment variables that outrank a
|
||||
// config.yaml actor, so a test asserting the config value is rebound does not
|
||||
// depend on the developer's shell (GH#6560). BEADS_ACTOR outranks it
|
||||
// deliberately: resolveConfiguredActor checks the env first, which is the
|
||||
// GH#4645 fix. BD_ACTOR does too, because viper's BD-prefixed AutomaticEnv
|
||||
// reads it as the actor key ahead of the file. CI runners set neither, which is
|
||||
// why these tests only ever failed locally.
|
||||
func clearActorEnv(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Setenv("BEADS_ACTOR", "")
|
||||
t.Setenv("BD_ACTOR", "")
|
||||
}
|
||||
|
||||
func TestPrepareSelectedCommandContext_RebindsTargetConfig(t *testing.T) {
|
||||
t.Setenv("BEADS_DOLT_SERVER_DATABASE", "")
|
||||
t.Setenv("BEADS_DOLT_SERVER_PORT", "")
|
||||
clearActorEnv(t)
|
||||
|
||||
callerDir := t.TempDir()
|
||||
callerBeadsDir := filepath.Join(callerDir, ".beads")
|
||||
|
|
@ -134,6 +148,7 @@ func TestPrepareSelectedCommandContext_RebindsTargetConfig(t *testing.T) {
|
|||
func TestPrepareSelectedCommandContext_DoesNotMergeCallerConfigForUnsetKeys(t *testing.T) {
|
||||
t.Setenv("BEADS_DOLT_SERVER_DATABASE", "")
|
||||
t.Setenv("BEADS_DOLT_SERVER_PORT", "")
|
||||
clearActorEnv(t)
|
||||
|
||||
root := t.TempDir()
|
||||
callerDir := filepath.Join(root, "caller")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue