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 (
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
+18 -18
View File
@@ -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())
}
}