Rename configuration selection to overlays
This commit is contained in:
@@ -38,8 +38,8 @@ func TestRunControlsRejectSyntaxWithoutAllocatingState(t *testing.T) {
|
||||
{name: "blank debug directory", args: func(roots stateTestRoots) []string {
|
||||
return []string{"run", "sample", "--config", roots.config, "--input", roots.input, "--debug-dir", ""}
|
||||
}},
|
||||
{name: "missing configuration profile", args: func(roots stateTestRoots) []string {
|
||||
return []string{"run", "sample", "--config", roots.config, "--input", roots.input, "--config-profile"}
|
||||
{name: "missing configuration overlay", args: func(roots stateTestRoots) []string {
|
||||
return []string{"run", "sample", "--config", roots.config, "--input", roots.input, "--config-overlay"}
|
||||
}},
|
||||
{name: "debug directory without debug", args: func(roots stateTestRoots) []string {
|
||||
return []string{"run", "sample", "--config", roots.config, "--input", roots.input, "--debug-dir", filepath.Join(filepath.Dir(roots.debug), "requested-debug")}
|
||||
@@ -247,38 +247,38 @@ func TestRunStateRootsHonorEnvironmentFlagsAndDefaults(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestRunAppliesConfigurationProfileAndRecordsSelection(t *testing.T) {
|
||||
func TestRunAppliesConfigurationOverlayAndRecordsSelection(t *testing.T) {
|
||||
roots := newStateTestRoots(t)
|
||||
profileDirectory := filepath.Join(filepath.Dir(roots.config), "profiles")
|
||||
profileOutput := filepath.Join(profileDirectory, "profile-output")
|
||||
profileDebug := filepath.Join(profileDirectory, "profile-debug")
|
||||
writeConfigKitFile(t, filepath.Join(profileDirectory, "development.yml"), "output:\n directory: ./profile-output\ndebug:\n directory: ./profile-debug\n")
|
||||
overlayDirectory := filepath.Join(filepath.Dir(roots.config), "overlays")
|
||||
overlayOutput := filepath.Join(overlayDirectory, "overlay-output")
|
||||
overlayDebug := filepath.Join(overlayDirectory, "overlay-debug")
|
||||
writeConfigKitFile(t, filepath.Join(overlayDirectory, "development.yml"), "output:\n directory: ./overlay-output\ndebug:\n directory: ./overlay-debug\n")
|
||||
|
||||
var stdout, stderr bytes.Buffer
|
||||
code := RunWithOptions([]string{
|
||||
"run", "sample", "--config", roots.config, "--config-profile", "development",
|
||||
"run", "sample", "--config", roots.config, "--config-overlay", "development",
|
||||
"--input", roots.input, "--chunk_cache", "bypass", "--debug",
|
||||
}, &stdout, &stderr, newStateTestHarness().options())
|
||||
if code != 0 || stderr.Len() != 0 {
|
||||
t.Fatalf("code=%d stdout=%q stderr=%q", code, stdout.String(), stderr.String())
|
||||
}
|
||||
assertFile(t, filepath.Join(profileOutput, filepath.Base(onlyChildDir(t, profileOutput)), "result.json"))
|
||||
bundle := onlyChildDir(t, profileDebug)
|
||||
assertFile(t, filepath.Join(overlayOutput, filepath.Base(onlyChildDir(t, overlayOutput)), "result.json"))
|
||||
bundle := onlyChildDir(t, overlayDebug)
|
||||
var invocation debugbundle.Invocation
|
||||
readStateTestSummaryJSON(t, bundle, "invocation.json", &invocation)
|
||||
if invocation.ConfigProfile != "development" {
|
||||
t.Fatalf("config profile = %q, want development", invocation.ConfigProfile)
|
||||
if invocation.ConfigOverlay != "development" {
|
||||
t.Fatalf("config overlay = %q, want development", invocation.ConfigOverlay)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEffectiveConfigProfileOmitsBaseSelection(t *testing.T) {
|
||||
for _, profile := range []string{"", "default"} {
|
||||
if got := effectiveConfigProfile(profile); got != "" {
|
||||
t.Fatalf("effectiveConfigProfile(%q) = %q, want empty", profile, got)
|
||||
func TestEffectiveConfigOverlayOmitsBaseSelection(t *testing.T) {
|
||||
for _, overlay := range []string{"", "default"} {
|
||||
if got := effectiveConfigOverlay(overlay); got != "" {
|
||||
t.Fatalf("effectiveConfigOverlay(%q) = %q, want empty", overlay, got)
|
||||
}
|
||||
}
|
||||
if got := effectiveConfigProfile("development"); got != "development" {
|
||||
t.Fatalf("effectiveConfigProfile(development) = %q", got)
|
||||
if got := effectiveConfigOverlay("development"); got != "development" {
|
||||
t.Fatalf("effectiveConfigOverlay(development) = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user