rename: MIRE_VISIBLE_HOME to MIRE_HOME

This commit is contained in:
2026-03-21 23:04:11 +00:00
parent 254b9d28a5
commit 3dfe7a8b67
6 changed files with 34 additions and 34 deletions
+3 -3
View File
@@ -17,7 +17,7 @@ const DefaultVisibleHome = "/home/test"
var ( var (
lowerSnakeCasePattern = regexp.MustCompile(`^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$`) lowerSnakeCasePattern = regexp.MustCompile(`^[a-z][a-z0-9]*(?:_[a-z0-9]+)*$`)
requiredSandboxDefaults = map[string]string{ 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"]) { if !filepath.IsAbs(validated["home"]) {
return nil, fmt.Errorf("failed to read %s: sandbox.visible_home must be an absolute path", path) return nil, fmt.Errorf("failed to read %s: sandbox.home must be an absolute path", path)
} }
return validated, nil return validated, nil
+18 -18
View File
@@ -19,11 +19,11 @@ func TestReadConfig(t *testing.T) {
}{ }{
{ {
name: "with test dir and sandbox", 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", wantDir: "custom/suite",
wantSandbox: map[string]string{ wantSandbox: map[string]string{
"visible_home": "/home/test", "home": "/home/test",
"key_word": "value", "key_word": "value",
}, },
}, },
{ {
@@ -52,23 +52,23 @@ func TestReadConfig(t *testing.T) {
wantErr: "missing [sandbox] config", wantErr: "missing [sandbox] config",
}, },
{ {
name: "without required visible home", name: "without required home",
content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\n", 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", name: "empty required home",
content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nvisible_home = \"\"\n", content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nhome = \"\"\n",
wantErr: "empty sandbox.visible_home", wantErr: "empty sandbox.home",
}, },
{ {
name: "relative visible home", name: "relative home",
content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nvisible_home = \"home/test\"\n", content: "[mire]\ntest_dir = \"custom/suite\"\n\n[sandbox]\nhome = \"home/test\"\n",
wantErr: "sandbox.visible_home must be an absolute path", wantErr: "sandbox.home must be an absolute path",
}, },
{ {
name: "invalid sandbox key", 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", wantErr: "invalid sandbox key",
}, },
{ {
@@ -131,9 +131,9 @@ func TestWriteConfig(t *testing.T) {
if err := WriteConfig(path, Config{ if err := WriteConfig(path, Config{
TestDir: "e2e", TestDir: "e2e",
Sandbox: map[string]string{ Sandbox: map[string]string{
"visible_home": "/home/test", "home": "/home/test",
"alpha_key": "a", "alpha_key": "a",
"zulu_key": "z", "zulu_key": "z",
}, },
}); err != nil { }); err != nil {
t.Fatalf("WriteConfig() error = %v", err) t.Fatalf("WriteConfig() error = %v", err)
@@ -143,7 +143,7 @@ func TestWriteConfig(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("ReadFile() error = %v", err) 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 { if string(got) != want {
t.Fatalf("config = %q, want %q", string(got), want) t.Fatalf("config = %q, want %q", string(got), want)
} }
@@ -171,7 +171,7 @@ func TestWriteConfigMissingRequiredSandboxFails(t *testing.T) {
if err == nil { if err == nil {
t.Fatal("WriteConfig() error = nil, want error") t.Fatal("WriteConfig() error = nil, want error")
} }
if !strings.Contains(err.Error(), "missing required sandbox.visible_home") { if !strings.Contains(err.Error(), "missing required sandbox.home") {
t.Fatalf("WriteConfig() error = %q, want visible_home error", err.Error()) t.Fatalf("WriteConfig() error = %q, want home error", err.Error())
} }
} }
+1 -1
View File
@@ -5,7 +5,7 @@ set -eu
host_home=${MIRE_HOST_HOME:?} host_home=${MIRE_HOST_HOME:?}
host_tmp=${MIRE_HOST_TMP:?} host_tmp=${MIRE_HOST_TMP:?}
path_env=${MIRE_PATH_ENV:?} path_env=${MIRE_PATH_ENV:?}
visible_home=${MIRE_VISIBLE_HOME:?} visible_home=${MIRE_HOME:?}
bootstrap_rc="$host_home/.mire-shell-rc" bootstrap_rc="$host_home/.mire-shell-rc"
visible_bootstrap_rc="$visible_home/.mire-shell-rc" visible_bootstrap_rc="$visible_home/.mire-shell-rc"
setup_scripts_dir='/tmp/mire-setup-scripts' setup_scripts_dir='/tmp/mire-setup-scripts'
+9 -9
View File
@@ -119,7 +119,7 @@ func TestBuildRecordShellScriptUsesExpectedCommands(t *testing.T) {
"host_home=${MIRE_HOST_HOME:?}", "host_home=${MIRE_HOST_HOME:?}",
"host_tmp=${MIRE_HOST_TMP:?}", "host_tmp=${MIRE_HOST_TMP:?}",
"path_env=${MIRE_PATH_ENV:?}", "path_env=${MIRE_PATH_ENV:?}",
"visible_home=${MIRE_VISIBLE_HOME:?}", "visible_home=${MIRE_HOME:?}",
"bootstrap_rc=\"$host_home/.mire-shell-rc\"", "bootstrap_rc=\"$host_home/.mire-shell-rc\"",
"setup_scripts_dir='/tmp/mire-setup-scripts'", "setup_scripts_dir='/tmp/mire-setup-scripts'",
"visible_bootstrap_rc=\"$visible_home/.mire-shell-rc\"", "visible_bootstrap_rc=\"$visible_home/.mire-shell-rc\"",
@@ -159,8 +159,8 @@ func TestRecordSessionEnvIncludesConfiguredSandboxEnv(t *testing.T) {
hostTmp: "/tmp/host-tmp", hostTmp: "/tmp/host-tmp",
pathEnv: "/tmp/bin", pathEnv: "/tmp/bin",
}, map[string]string{ }, map[string]string{
"visible_home": "/sandbox/home", "home": "/sandbox/home",
"key_word": "value", "key_word": "value",
}, []string{"/repo/e2e/setup.sh", "/repo/e2e/suite/setup.sh"}) }, []string{"/repo/e2e/setup.sh", "/repo/e2e/suite/setup.sh"})
for _, want := range []string{ for _, want := range []string{
@@ -168,7 +168,7 @@ func TestRecordSessionEnvIncludesConfiguredSandboxEnv(t *testing.T) {
"MIRE_HOST_TMP=/tmp/host-tmp", "MIRE_HOST_TMP=/tmp/host-tmp",
"MIRE_PATH_ENV=/tmp/bin", "MIRE_PATH_ENV=/tmp/bin",
"MIRE_KEY_WORD=value", "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", "MIRE_SETUP_SCRIPTS=/repo/e2e/setup.sh\n/repo/e2e/suite/setup.sh",
} { } {
if !containsEnvEntry(env, want) { if !containsEnvEntry(env, want) {
@@ -186,7 +186,7 @@ func TestRecordSessionEnvWithExtraIncludesAdditionalEntries(t *testing.T) {
hostTmp: "/tmp/host-tmp", hostTmp: "/tmp/host-tmp",
pathEnv: "/tmp/bin", pathEnv: "/tmp/bin",
}, map[string]string{ }, map[string]string{
"visible_home": "/sandbox/home", "home": "/sandbox/home",
}, []string{"/repo/e2e/setup.sh"}, map[string]string{ }, []string{"/repo/e2e/setup.sh"}, map[string]string{
compareMarkerEnvName: compareMarkerEnabledValue, compareMarkerEnvName: compareMarkerEnabledValue,
}) })
@@ -195,7 +195,7 @@ func TestRecordSessionEnvWithExtraIncludesAdditionalEntries(t *testing.T) {
"MIRE_HOST_HOME=/tmp/host-home", "MIRE_HOST_HOME=/tmp/host-home",
"MIRE_HOST_TMP=/tmp/host-tmp", "MIRE_HOST_TMP=/tmp/host-tmp",
"MIRE_PATH_ENV=/tmp/bin", "MIRE_PATH_ENV=/tmp/bin",
"MIRE_VISIBLE_HOME=/sandbox/home", "MIRE_HOME=/sandbox/home",
"MIRE_SETUP_SCRIPTS=/repo/e2e/setup.sh", "MIRE_SETUP_SCRIPTS=/repo/e2e/setup.sh",
"MIRE_COMPARE_MARKER=1", "MIRE_COMPARE_MARKER=1",
} { } {
@@ -251,10 +251,10 @@ func TestRecordScenarioUsesDeterministicSandbox(t *testing.T) {
testutil.MustMkdirAll(t, target) testutil.MustMkdirAll(t, target)
mustWriteRecordShell(t, testDir) mustWriteRecordShell(t, testDir)
sandboxConfig := map[string]string{ sandboxConfig := map[string]string{
"visible_home": "/home/test", "home": "/home/test",
"key_word": "value", "key_word": "value",
} }
visibleHome := sandboxConfig["visible_home"] visibleHome := sandboxConfig["home"]
err := testutil.WithWorkingDir(t, root, func() error { err := testutil.WithWorkingDir(t, root, func() error {
return withPromptedRecordStreams( return withPromptedRecordStreams(
+1 -1
View File
@@ -117,7 +117,7 @@ func mustWriteRecordShell(t *testing.T, testDir string) {
func defaultSandboxConfig() map[string]string { func defaultSandboxConfig() map[string]string {
return map[string]string{ return map[string]string{
"visible_home": "/home/test", "home": "/home/test",
} }
} }
+2 -2
View File
@@ -438,9 +438,9 @@ func MustGitInit(t *testing.T, dir string) {
} }
func DefaultWrittenConfig(testDir string) 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 { 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"
} }