From 3dfe7a8b67c4463fd546ca57eb255675c71414b6 Mon Sep 17 00:00:00 2001 From: ruinivist Date: Sat, 21 Mar 2026 23:04:11 +0000 Subject: [PATCH] rename: MIRE_VISIBLE_HOME to MIRE_HOME --- internal/config/config.go | 6 +++--- internal/config/config_test.go | 36 +++++++++++++++---------------- internal/mire/record_shell.sh | 2 +- internal/mire/record_test.go | 18 ++++++++-------- internal/mire/testhelpers_test.go | 2 +- internal/testutil/testutil.go | 4 ++-- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/internal/config/config.go b/internal/config/config.go index 019db5c..3f68105 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -17,7 +17,7 @@ const DefaultVisibleHome = "/home/test" var ( lowerSnakeCasePattern = regexp.MustCompile(`^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$`) requiredSandboxDefaults = map[string]string{ - "visible_home": DefaultVisibleHome, + "home": DefaultVisibleHome, } ) @@ -118,8 +118,8 @@ func validateSandbox(path string, sandbox map[string]string) (map[string]string, } } - if !filepath.IsAbs(validated["visible_home"]) { - return nil, fmt.Errorf("failed to read %s: sandbox.visible_home must be an absolute path", path) + if !filepath.IsAbs(validated["home"]) { + return nil, fmt.Errorf("failed to read %s: sandbox.home must be an absolute path", path) } return validated, nil diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 94743cf..0716fc4 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -19,11 +19,11 @@ func TestReadConfig(t *testing.T) { }{ { name: "with test dir and sandbox", - content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nvisible_home = \"/home/test\"\nkey_word = \"value\"\n", + content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nhome = \"/home/test\"\nkey_word = \"value\"\n", wantDir: "custom/suite", wantSandbox: map[string]string{ - "visible_home": "/home/test", - "key_word": "value", + "home": "/home/test", + "key_word": "value", }, }, { @@ -52,23 +52,23 @@ func TestReadConfig(t *testing.T) { wantErr: "missing [sandbox] config", }, { - name: "without required visible home", + name: "without required home", content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\n", - wantErr: "missing required sandbox.visible_home", + wantErr: "missing required sandbox.home", }, { - name: "empty required visible home", - content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nvisible_home = \"\"\n", - wantErr: "empty sandbox.visible_home", + name: "empty required home", + content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nhome = \"\"\n", + wantErr: "empty sandbox.home", }, { - name: "relative visible home", - content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nvisible_home = \"home/test\"\n", - wantErr: "sandbox.visible_home must be an absolute path", + name: "relative home", + content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nhome = \"home/test\"\n", + wantErr: "sandbox.home must be an absolute path", }, { name: "invalid sandbox key", - content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nvisible_home = \"/home/test\"\nKeyWord = \"value\"\n", + content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nhome = \"/home/test\"\nKeyWord = \"value\"\n", wantErr: "invalid sandbox key", }, { @@ -131,9 +131,9 @@ func TestWriteConfig(t *testing.T) { if err := WriteConfig(path, Config{ TestDir: "e2e", Sandbox: map[string]string{ - "visible_home": "/home/test", - "alpha_key": "a", - "zulu_key": "z", + "home": "/home/test", + "alpha_key": "a", + "zulu_key": "z", }, }); err != nil { t.Fatalf("WriteConfig() error = %v", err) @@ -143,7 +143,7 @@ func TestWriteConfig(t *testing.T) { if err != nil { t.Fatalf("ReadFile() error = %v", err) } - want := "[mire]\n test_dir = \"e2e\"\n\n[sandbox]\n alpha_key = \"a\"\n visible_home = \"/home/test\"\n zulu_key = \"z\"\n" + want := "[mire]\n test_dir = \"e2e\"\n\n[sandbox]\n alpha_key = \"a\"\n home = \"/home/test\"\n zulu_key = \"z\"\n" if string(got) != want { t.Fatalf("config = %q, want %q", string(got), want) } @@ -171,7 +171,7 @@ func TestWriteConfigMissingRequiredSandboxFails(t *testing.T) { if err == nil { t.Fatal("WriteConfig() error = nil, want error") } - if !strings.Contains(err.Error(), "missing required sandbox.visible_home") { - t.Fatalf("WriteConfig() error = %q, want visible_home error", err.Error()) + if !strings.Contains(err.Error(), "missing required sandbox.home") { + t.Fatalf("WriteConfig() error = %q, want home error", err.Error()) } } diff --git a/internal/mire/record_shell.sh b/internal/mire/record_shell.sh index 99b321c..c19e432 100644 --- a/internal/mire/record_shell.sh +++ b/internal/mire/record_shell.sh @@ -5,7 +5,7 @@ set -eu host_home=${MIRE_HOST_HOME:?} host_tmp=${MIRE_HOST_TMP:?} path_env=${MIRE_PATH_ENV:?} -visible_home=${MIRE_VISIBLE_HOME:?} +visible_home=${MIRE_HOME:?} bootstrap_rc="$host_home/.mire-shell-rc" visible_bootstrap_rc="$visible_home/.mire-shell-rc" setup_scripts_dir='/tmp/mire-setup-scripts' diff --git a/internal/mire/record_test.go b/internal/mire/record_test.go index c68a49c..fe72435 100644 --- a/internal/mire/record_test.go +++ b/internal/mire/record_test.go @@ -119,7 +119,7 @@ func TestBuildRecordShellScriptUsesExpectedCommands(t *testing.T) { "host_home=${MIRE_HOST_HOME:?}", "host_tmp=${MIRE_HOST_TMP:?}", "path_env=${MIRE_PATH_ENV:?}", - "visible_home=${MIRE_VISIBLE_HOME:?}", + "visible_home=${MIRE_HOME:?}", "bootstrap_rc=\"$host_home/.mire-shell-rc\"", "setup_scripts_dir='/tmp/mire-setup-scripts'", "visible_bootstrap_rc=\"$visible_home/.mire-shell-rc\"", @@ -159,8 +159,8 @@ func TestRecordSessionEnvIncludesConfiguredSandboxEnv(t *testing.T) { hostTmp: "/tmp/host-tmp", pathEnv: "/tmp/bin", }, map[string]string{ - "visible_home": "/sandbox/home", - "key_word": "value", + "home": "/sandbox/home", + "key_word": "value", }, []string{"/repo/e2e/setup.sh", "/repo/e2e/suite/setup.sh"}) for _, want := range []string{ @@ -168,7 +168,7 @@ func TestRecordSessionEnvIncludesConfiguredSandboxEnv(t *testing.T) { "MIRE_HOST_TMP=/tmp/host-tmp", "MIRE_PATH_ENV=/tmp/bin", "MIRE_KEY_WORD=value", - "MIRE_VISIBLE_HOME=/sandbox/home", + "MIRE_HOME=/sandbox/home", "MIRE_SETUP_SCRIPTS=/repo/e2e/setup.sh\n/repo/e2e/suite/setup.sh", } { if !containsEnvEntry(env, want) { @@ -186,7 +186,7 @@ func TestRecordSessionEnvWithExtraIncludesAdditionalEntries(t *testing.T) { hostTmp: "/tmp/host-tmp", pathEnv: "/tmp/bin", }, map[string]string{ - "visible_home": "/sandbox/home", + "home": "/sandbox/home", }, []string{"/repo/e2e/setup.sh"}, map[string]string{ compareMarkerEnvName: compareMarkerEnabledValue, }) @@ -195,7 +195,7 @@ func TestRecordSessionEnvWithExtraIncludesAdditionalEntries(t *testing.T) { "MIRE_HOST_HOME=/tmp/host-home", "MIRE_HOST_TMP=/tmp/host-tmp", "MIRE_PATH_ENV=/tmp/bin", - "MIRE_VISIBLE_HOME=/sandbox/home", + "MIRE_HOME=/sandbox/home", "MIRE_SETUP_SCRIPTS=/repo/e2e/setup.sh", "MIRE_COMPARE_MARKER=1", } { @@ -251,10 +251,10 @@ func TestRecordScenarioUsesDeterministicSandbox(t *testing.T) { testutil.MustMkdirAll(t, target) mustWriteRecordShell(t, testDir) sandboxConfig := map[string]string{ - "visible_home": "/home/test", - "key_word": "value", + "home": "/home/test", + "key_word": "value", } - visibleHome := sandboxConfig["visible_home"] + visibleHome := sandboxConfig["home"] err := testutil.WithWorkingDir(t, root, func() error { return withPromptedRecordStreams( diff --git a/internal/mire/testhelpers_test.go b/internal/mire/testhelpers_test.go index 427e0cf..2f6a1c5 100644 --- a/internal/mire/testhelpers_test.go +++ b/internal/mire/testhelpers_test.go @@ -117,7 +117,7 @@ func mustWriteRecordShell(t *testing.T, testDir string) { func defaultSandboxConfig() map[string]string { return map[string]string{ - "visible_home": "/home/test", + "home": "/home/test", } } diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go index 007da68..94fe1a2 100644 --- a/internal/testutil/testutil.go +++ b/internal/testutil/testutil.go @@ -438,9 +438,9 @@ func MustGitInit(t *testing.T, dir string) { } func DefaultWrittenConfig(testDir string) string { - return "[mire]\n test_dir = \"" + testDir + "\"\n\n[sandbox]\n visible_home = \"/home/test\"\n" + return "[mire]\n test_dir = \"" + testDir + "\"\n\n[sandbox]\n home = \"/home/test\"\n" } func ValidConfigContent(testDir string) string { - return "[mire]\ntest_dir = \"" + testDir + "\"\n\n[sandbox]\nvisible_home = \"/home/test\"\n" + return "[mire]\ntest_dir = \"" + testDir + "\"\n\n[sandbox]\nhome = \"/home/test\"\n" }