Remove the secrets directory flag and update fixtures
This commit is contained in:
@@ -24,7 +24,7 @@ func TestNativeDiscoveryDoesNotAcquireConfiguration(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
application, err := newApplication(commandDependencies{
|
||||
loadPipelineConfig: func(string, config.PipelineLoadOptions) (*config.PipelineConfig, error) {
|
||||
loadPipelineSource: func(configkit.Source, config.PipelineLoadOptions) (*config.PipelineConfig, error) {
|
||||
t.Fatal("discovery loaded pipeline configuration")
|
||||
return nil, nil
|
||||
},
|
||||
@@ -32,9 +32,9 @@ func TestNativeDiscoveryDoesNotAcquireConfiguration(t *testing.T) {
|
||||
t.Fatal("discovery initialized object storage")
|
||||
return nil, nil
|
||||
},
|
||||
loadSecretsDir: func(string) (*configkit.SecretsReport, error) {
|
||||
preparePipelineSource: func(configkit.Source) (*configkit.SecretsReport, configkit.Source, error) {
|
||||
t.Fatal("discovery bootstrapped credentials")
|
||||
return nil, nil
|
||||
return nil, configkit.Source{}, nil
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
@@ -51,7 +51,7 @@ func TestNativeDiscoveryDoesNotAcquireConfiguration(t *testing.T) {
|
||||
args []string
|
||||
fragment string
|
||||
}{
|
||||
{[]string{"__complete", "run", "--config", "missing.yml", "--secrets-dir", "missing-secrets", "--stage", "tr"}, "transcribe\n"},
|
||||
{[]string{"__complete", "run", "--config", "missing.yml", "--stage", "tr"}, "transcribe\n"},
|
||||
{[]string{"__complete", "session", "plan", "--from", "an"}, "analyze\n"},
|
||||
{[]string{"__complete", "run", "--through", "pub"}, "publish\n"},
|
||||
{[]string{"__complete", "config", "show", "--scope", ""}, "party\n"},
|
||||
@@ -61,7 +61,6 @@ func TestNativeDiscoveryDoesNotAcquireConfiguration(t *testing.T) {
|
||||
{[]string{"__complete", "config", "diff", "--scope", "party", "--against-party-file", ""}, ":0\n"},
|
||||
{[]string{"__complete", "session", "init", "--output", ""}, ":0\n"},
|
||||
{[]string{"__complete", "session", "init", "--audio-dir", ""}, ":16\n"},
|
||||
{[]string{"__complete", "run", "--secrets-dir", ""}, ":16\n"},
|
||||
} {
|
||||
var out, diagnostics bytes.Buffer
|
||||
outcome := application.Execute(context.Background(), query.args, commandkit.Streams{Out: &out, Err: &diagnostics})
|
||||
@@ -80,7 +79,7 @@ func TestNativeSelectionRetainsPresenceAndCallerContext(t *testing.T) {
|
||||
ctx := context.WithValue(context.Background(), contextKey{}, "caller")
|
||||
application, err := commandkit.New(commandkit.Identity{Name: "narratio"}, commandkit.NewCommand(commandkit.CommandSpec[configurationSelection]{
|
||||
Name: "inspect",
|
||||
Flags: []commandkit.Flag[configurationSelection]{flags.Config, flags.Overlay, flags.Campaign, flags.CampaignFile, flags.Session, flags.SessionFile, flags.PartyFile, flags.SecretsDir},
|
||||
Flags: []commandkit.Flag[configurationSelection]{flags.Config, flags.Overlay, flags.Campaign, flags.CampaignFile, flags.Session, flags.SessionFile, flags.PartyFile},
|
||||
CheckInput: func(in configurationSelection) error {
|
||||
if !in.Config.Set || in.Config.Value != "" || !in.Campaign.Set || !in.CampaignFile.Set || in.PartyFile.Set {
|
||||
t.Fatalf("selection lost presence or complementary selectors: %+v", in)
|
||||
@@ -153,13 +152,13 @@ func TestOperationOutcomePreservesCausesAndOperationalPrecedence(t *testing.T) {
|
||||
|
||||
func TestNativeTreeRejectsRemovedRoutesAndMissingOperandsBeforeAcquisition(t *testing.T) {
|
||||
application, err := newApplication(commandDependencies{
|
||||
loadPipelineConfig: func(string, config.PipelineLoadOptions) (*config.PipelineConfig, error) {
|
||||
loadPipelineSource: func(configkit.Source, config.PipelineLoadOptions) (*config.PipelineConfig, error) {
|
||||
t.Fatal("invalid input loaded configuration")
|
||||
return nil, nil
|
||||
},
|
||||
loadSecretsDir: func(string) (*configkit.SecretsReport, error) {
|
||||
preparePipelineSource: func(configkit.Source) (*configkit.SecretsReport, configkit.Source, error) {
|
||||
t.Fatal("invalid input bootstrapped credentials")
|
||||
return nil, nil
|
||||
return nil, configkit.Source{}, nil
|
||||
},
|
||||
}, nil)
|
||||
if err != nil {
|
||||
@@ -233,3 +232,21 @@ func TestNativeDiagnosticsRetainWarningsAndJoinedOperationalCause(t *testing.T)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemovedSecretsDirectoryFlagIsUnavailable(t *testing.T) {
|
||||
app, err := newApplication(commandDependencies{}, executePlan)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var output, diagnostics bytes.Buffer
|
||||
result := app.Execute(context.Background(), []string{"run", "--help"}, commandkit.Streams{Out: &output, Err: &diagnostics})
|
||||
if result.Status != 0 || strings.Contains(output.String(), "--secrets-dir") {
|
||||
t.Fatalf("help exposes removed flag: %s", output.String())
|
||||
}
|
||||
output.Reset()
|
||||
diagnostics.Reset()
|
||||
result = app.Execute(context.Background(), []string{"run", "session", "--secrets-dir", "credentials"}, commandkit.Streams{Out: &output, Err: &diagnostics})
|
||||
if result.Status != 2 || !strings.Contains(diagnostics.String(), "--secrets-dir") {
|
||||
t.Fatalf("removed flag: status=%d diagnostics=%s", result.Status, diagnostics.String())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user