Suggest PromptKit smoke test kinds
This commit is contained in:
@@ -353,12 +353,16 @@ func TestComposedCatalogsAndSmokeUseInjectedClientOnlyForInference(t *testing.T)
|
||||
}
|
||||
|
||||
func TestComposedCompletionUsesHintsWithoutLoadingEngine(t *testing.T) {
|
||||
var loads, calls int
|
||||
var loads, calls, smokeCalls int
|
||||
loader := func(ctx context.Context, selection ckconfig.Selection, input *inspectionInput, cache *runCache) (*promptkit.Engine, error) {
|
||||
loads++
|
||||
return loadPromptEngine(ctx, selection, input, cache)
|
||||
}
|
||||
app, err := newAppWithEngineLoader(&exampleLLMClient{calls: &calls}, loader, nil)
|
||||
smoke := func(context.Context, ckprompt.SmokeRequest, *inspectionInput, *runCache) (commandkit.Acquired[*promptkit.SmokeTestReport], error) {
|
||||
smokeCalls++
|
||||
return commandkit.Acquired[*promptkit.SmokeTestReport]{}, nil
|
||||
}
|
||||
app, err := newAppWithEngineLoader(&exampleLLMClient{calls: &calls}, loader, smoke)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -366,6 +370,8 @@ func TestComposedCompletionUsesHintsWithoutLoadingEngine(t *testing.T) {
|
||||
args []string
|
||||
want string
|
||||
}{
|
||||
{[]string{"__complete", "promptkit", "test", "re"}, "reachability\n"},
|
||||
{[]string{"__complete", "smoke", "al"}, "all\n"},
|
||||
{[]string{"__complete", "pk", "show", "prompt", "briefing", "--fmt=y"}, "yaml\n"},
|
||||
{[]string{"__complete", "pk", "show", "prompt", "briefing", "--config=fixtures/"}, ":0\n"},
|
||||
} {
|
||||
@@ -375,8 +381,8 @@ func TestComposedCompletionUsesHintsWithoutLoadingEngine(t *testing.T) {
|
||||
t.Fatalf("query %q outcome=%#v output=%q", tc.args, outcome, output.String())
|
||||
}
|
||||
}
|
||||
if loads != 0 || calls != 0 {
|
||||
t.Fatalf("completion loaded engine %d times and invoked client %d times", loads, calls)
|
||||
if loads != 0 || calls != 0 || smokeCalls != 0 {
|
||||
t.Fatalf("completion loaded engine %d times and invoked client %d times, smoke calls=%d", loads, calls, smokeCalls)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user