Add opt-in PromptKit namespaces
This commit is contained in:
@@ -11,13 +11,14 @@ import (
|
||||
)
|
||||
|
||||
type smokeCommandInput[I any] struct {
|
||||
selection ckconfig.Selection
|
||||
kind string
|
||||
request promptkit.SmokeTestRequest
|
||||
execution ExecutionInput
|
||||
resources ResourceInput
|
||||
captured commandkit.FlagValues[I]
|
||||
selected I
|
||||
namespaces namespaceInput
|
||||
selection ckconfig.Selection
|
||||
kind string
|
||||
request promptkit.SmokeTestRequest
|
||||
execution ExecutionInput
|
||||
resources ResourceInput
|
||||
captured commandkit.FlagValues[I]
|
||||
selected I
|
||||
}
|
||||
|
||||
func newSmokeTestCommand[I, S any](suite Suite[I, S]) commandkit.Command {
|
||||
@@ -43,6 +44,10 @@ func newSmokeTestCommand[I, S any](suite Suite[I, S]) commandkit.Command {
|
||||
flags = append(flags, resources.Backend, resources.Prompt, resources.Profile)
|
||||
flags = append(flags, execution.All()...)
|
||||
|
||||
if suite.namespaces != nil {
|
||||
flags = append(flags, namespaceFlags(func(input **smokeCommandInput[I]) *namespaceInput { return &(*input).namespaces }, "prompt", "profile", "backend")...)
|
||||
}
|
||||
|
||||
return commandkit.NewCommand(commandkit.CommandSpec[*smokeCommandInput[I]]{
|
||||
Name: "test",
|
||||
Summary: "Run one PromptKit smoke test.",
|
||||
@@ -94,7 +99,7 @@ func runSmokeTest[I, S any](invocation commandkit.Invocation, suite Suite[I, S],
|
||||
return runSmokeAggregate(invocation, suite, input, state)
|
||||
}
|
||||
|
||||
request := SmokeRequest{Selection: input.selection, Request: input.request}
|
||||
request := SmokeRequest{Selection: input.selection, Request: input.request, Namespaces: selectedNamespaces(suite.namespaces, input.namespaces)}
|
||||
acquired, operationErr := suite.SmokeTest(invocation.Context, request, input.selected, state)
|
||||
queuePromptDiagnostics(invocation.Reporter(), acquired.Diagnostics)
|
||||
if acquired.Value == nil && operationErr == nil {
|
||||
@@ -143,7 +148,7 @@ func runSmokeAggregate[I, S any](invocation commandkit.Invocation, suite Suite[I
|
||||
}
|
||||
|
||||
seed := smokeRequestForKind(input.request, kind)
|
||||
acquired, operationErr := suite.SmokeTest(invocation.Context, SmokeRequest{Selection: input.selection, Request: seed}, input.selected, state)
|
||||
acquired, operationErr := suite.SmokeTest(invocation.Context, SmokeRequest{Selection: input.selection, Request: seed, Namespaces: selectedNamespaces(suite.namespaces, input.namespaces)}, input.selected, state)
|
||||
if acquired.Value == nil && operationErr == nil {
|
||||
operationErr = errors.New("PromptKit smoke test returned neither a report nor an error")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user