Adopt Notarius configuration overlays
This commit is contained in:
@@ -691,17 +691,17 @@ func TestExtractLifecycleCredentialChangesRemainResumable(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractLifecycleConfigProfileChangesRerunExtractionAndDependents(t *testing.T) {
|
||||
func TestExtractLifecycleConfigOverlayChangesRerunExtractionAndDependents(t *testing.T) {
|
||||
cfg, env, runner := extractionLifecycleFixture(t, true)
|
||||
selected := "inexpensive"
|
||||
cfg.Pipeline.Notarius.ConfigProfile = &selected
|
||||
cfg.Pipeline.Notarius.ConfigOverlay = &selected
|
||||
analyzeRuns := 0
|
||||
plan := extractionLifecyclePlan(t, &analyzeRuns)
|
||||
|
||||
if _, err := executeStages(context.Background(), cfg, plan, RunOptions{Env: env}); err != nil {
|
||||
t.Fatalf("initial executeStages() error = %v", err)
|
||||
}
|
||||
if len(runner.requests) != 1 || runner.requests[0].ConfigProfile == nil || *runner.requests[0].ConfigProfile != selected || analyzeRuns != 1 {
|
||||
if len(runner.requests) != 1 || runner.requests[0].ConfigOverlay == nil || *runner.requests[0].ConfigOverlay != selected || analyzeRuns != 1 {
|
||||
t.Fatalf("initial requests=%#v analyze=%d, want selected extraction and analysis", runner.requests, analyzeRuns)
|
||||
}
|
||||
reused, err := executeStages(context.Background(), cfg, plan, RunOptions{Env: env})
|
||||
@@ -721,12 +721,12 @@ func TestExtractLifecycleConfigProfileChangesRerunExtractionAndDependents(t *tes
|
||||
}
|
||||
|
||||
changed := "experimental"
|
||||
cfg.Pipeline.Notarius.ConfigProfile = &changed
|
||||
cfg.Pipeline.Notarius.ConfigOverlay = &changed
|
||||
rerun, err := executeStages(context.Background(), cfg, plan, RunOptions{Env: env})
|
||||
if err != nil {
|
||||
t.Fatalf("changed-profile executeStages() error = %v", err)
|
||||
}
|
||||
if len(rerun.Executed) != 2 || len(runner.requests) != 2 || runner.requests[1].ConfigProfile == nil || *runner.requests[1].ConfigProfile != changed || analyzeRuns != 2 {
|
||||
if len(rerun.Executed) != 2 || len(runner.requests) != 2 || runner.requests[1].ConfigOverlay == nil || *runner.requests[1].ConfigOverlay != changed || analyzeRuns != 2 {
|
||||
t.Fatalf("changed-profile summary=%#v requests=%#v analyze=%d", rerun, runner.requests, analyzeRuns)
|
||||
}
|
||||
after := loadLifecycleManifest(t, cfg)
|
||||
@@ -741,12 +741,12 @@ func TestExtractLifecycleConfigProfileChangesRerunExtractionAndDependents(t *tes
|
||||
t.Fatalf("changed-profile lifecycle render=%#v analyze=%#v publish=%#v", after.Stages["render"], after.Stages["analyze"], after.Stages["publish"])
|
||||
}
|
||||
|
||||
cfg.Pipeline.Notarius.ConfigProfile = nil
|
||||
cfg.Pipeline.Notarius.ConfigOverlay = nil
|
||||
returned, err := executeStages(context.Background(), cfg, plan, RunOptions{Env: env})
|
||||
if err != nil {
|
||||
t.Fatalf("return-to-base executeStages() error = %v", err)
|
||||
}
|
||||
if len(returned.Executed) != 2 || len(runner.requests) != 3 || runner.requests[2].ConfigProfile != nil || analyzeRuns != 3 {
|
||||
if len(returned.Executed) != 2 || len(runner.requests) != 3 || runner.requests[2].ConfigOverlay != nil || analyzeRuns != 3 {
|
||||
t.Fatalf("return-to-base summary=%#v requests=%#v analyze=%d", returned, runner.requests, analyzeRuns)
|
||||
}
|
||||
final := loadLifecycleManifest(t, cfg)
|
||||
@@ -755,10 +755,10 @@ func TestExtractLifecycleConfigProfileChangesRerunExtractionAndDependents(t *tes
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractLifecycleConfigProfileFailureClearsCurrentResultAndDependents(t *testing.T) {
|
||||
func TestExtractLifecycleConfigOverlayFailureClearsCurrentResultAndDependents(t *testing.T) {
|
||||
cfg, env, runner := extractionLifecycleFixture(t, true)
|
||||
selected := "inexpensive"
|
||||
cfg.Pipeline.Notarius.ConfigProfile = &selected
|
||||
cfg.Pipeline.Notarius.ConfigOverlay = &selected
|
||||
analyzeRuns := 0
|
||||
plan := extractionLifecyclePlan(t, &analyzeRuns)
|
||||
if _, err := executeStages(context.Background(), cfg, plan, RunOptions{Env: env}); err != nil {
|
||||
@@ -768,7 +768,7 @@ func TestExtractLifecycleConfigProfileFailureClearsCurrentResultAndDependents(t
|
||||
markLifecycleStageSucceeded(t, cfg, "publish")
|
||||
|
||||
changed := "missing-profile"
|
||||
cfg.Pipeline.Notarius.ConfigProfile = &changed
|
||||
cfg.Pipeline.Notarius.ConfigOverlay = &changed
|
||||
runner.failuresRemaining = 1
|
||||
if _, err := executeStages(context.Background(), cfg, plan, RunOptions{Env: env}); err == nil {
|
||||
t.Fatal("changed-profile executeStages() error = nil, want downstream failure")
|
||||
@@ -783,12 +783,12 @@ func TestExtractLifecycleConfigProfileFailureClearsCurrentResultAndDependents(t
|
||||
t.Fatalf("failed changed-profile lifecycle trim=%#v render=%#v analyze=%#v publish=%#v analyzeRuns=%d",
|
||||
failed.Stages["trim"], failed.Stages["render"], failed.Stages["analyze"], failed.Stages["publish"], analyzeRuns)
|
||||
}
|
||||
if len(runner.requests) != 2 || runner.requests[1].ConfigProfile == nil || *runner.requests[1].ConfigProfile != changed {
|
||||
if len(runner.requests) != 2 || runner.requests[1].ConfigOverlay == nil || *runner.requests[1].ConfigOverlay != changed {
|
||||
t.Fatalf("failed request = %#v, want changed selector", runner.requests)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractLifecycleRealConfigProfilesSelectNotariusExplicitly(t *testing.T) {
|
||||
func TestExtractLifecycleRealConfigOverlaysSelectNotariusExplicitly(t *testing.T) {
|
||||
seed, env, runner := extractionLifecycleFixture(t, true)
|
||||
workspace := seed.Pipeline.Workspace.Root
|
||||
pipelinePath, campaignPath, sessionPath := writeValidConfigFiles(t, workspace)
|
||||
@@ -822,7 +822,7 @@ func TestExtractLifecycleRealConfigProfilesSelectNotariusExplicitly(t *testing.T
|
||||
t.Fatal(err)
|
||||
}
|
||||
for name, contents := range map[string]string{
|
||||
"testing": "whisperx:\n language: fr\nnotarius:\n config_profile: downstream-economy\n",
|
||||
"testing": "whisperx:\n language: fr\nnotarius:\n config_overlay: downstream-economy\n",
|
||||
"narratio-only": "whisperx:\n language: de\n",
|
||||
"narratio-only-two": "whisperx:\n language: es\n",
|
||||
} {
|
||||
@@ -848,7 +848,7 @@ func TestExtractLifecycleRealConfigProfilesSelectNotariusExplicitly(t *testing.T
|
||||
if _, err := executeStages(context.Background(), testingConfig, plan, RunOptions{Env: env}); err != nil {
|
||||
t.Fatalf("execute testing profile: %v", err)
|
||||
}
|
||||
if len(runner.requests) != 1 || runner.requests[0].ConfigProfile == nil || *runner.requests[0].ConfigProfile != "downstream-economy" {
|
||||
if len(runner.requests) != 1 || runner.requests[0].ConfigOverlay == nil || *runner.requests[0].ConfigOverlay != "downstream-economy" {
|
||||
t.Fatalf("testing profile request = %#v, want explicit differently named downstream selector", runner.requests)
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ func TestExtractLifecycleRealConfigProfilesSelectNotariusExplicitly(t *testing.T
|
||||
if _, err := executeStages(context.Background(), narratioOnly, plan, RunOptions{Env: env}); err != nil {
|
||||
t.Fatalf("execute Narratio-only profile: %v", err)
|
||||
}
|
||||
if len(runner.requests) != 2 || runner.requests[1].ConfigProfile != nil {
|
||||
if len(runner.requests) != 2 || runner.requests[1].ConfigOverlay != nil {
|
||||
t.Fatalf("Narratio-only profile request = %#v, want no automatic downstream selector", runner.requests)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user