Adopt the upstream fix for malformed prompt configuration
This commit is contained in:
@@ -41,24 +41,21 @@ func TestResourceCommandsRejectInvalidOperatorPrompts(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMalformedCompanionKeepsDelegatedExitStatusVisible(t *testing.T) {
|
||||
func TestMalformedCompanionReturnsInputFailure(t *testing.T) {
|
||||
main := writeRuntimeErrorConfig(t, "profiles: [\n")
|
||||
transcript := filepath.Join(filepath.Dir(main), "transcript.json")
|
||||
if err := os.WriteFile(transcript, []byte("[]\n"), 0600); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, tc := range []struct {
|
||||
args []string
|
||||
status int
|
||||
}{
|
||||
{[]string{"promptkit", "list", "prompts"}, 1},
|
||||
{[]string{"config", "show", "--scope", "promptkit"}, 1},
|
||||
{[]string{"process", transcript}, 2},
|
||||
for _, args := range [][]string{
|
||||
{"promptkit", "list", "prompts"},
|
||||
{"config", "show", "--scope", "promptkit"},
|
||||
{"process", transcript},
|
||||
} {
|
||||
var stdout, stderr bytes.Buffer
|
||||
code := Run(context.Background(), append(tc.args, "--config", main), &stdout, &stderr)
|
||||
if code != tc.status || !strings.Contains(stderr.String(), "yaml.invalid") || stdout.Len() != 0 {
|
||||
t.Fatalf("%v: status=%d want=%d stdout=%q stderr=%q", tc.args, code, tc.status, stdout.String(), stderr.String())
|
||||
code := Run(context.Background(), append(args, "--config", main), &stdout, &stderr)
|
||||
if code != 2 || !strings.Contains(stderr.String(), "yaml.invalid") || !strings.Contains(stderr.String(), "prompts.yml") || stdout.Len() != 0 {
|
||||
t.Errorf("%v: status=%d want=2 stdout=%q stderr=%q", args, code, stdout.String(), stderr.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user