feat: persist and dispatch client command input
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
package supervisor
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
rvboxv1 "github.com/rvbox/rvbox/gen/go/rvbox/v1"
|
||||
"github.com/rvbox/rvbox/internal/domain"
|
||||
)
|
||||
|
||||
func TestStartSpecValidation_BH_SUPERVISOR_01(t *testing.T) {
|
||||
t.Parallel()
|
||||
issue, err := domain.ParseUUIDv7("019c46f1-1d02-7000-8000-000000000091")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
cases := []StartSpec{
|
||||
{},
|
||||
{IssueUUID: issue, CommandRevision: 1, WorkingDirectory: `C:\work`},
|
||||
{IssueUUID: issue, CommandRevision: 1, Execution: &rvboxv1.ExecutionSpec{}, WorkingDirectory: `C:\work`},
|
||||
{IssueUUID: issue, CommandRevision: 1, Execution: &rvboxv1.ExecutionSpec{Source: &rvboxv1.ExecutionSpec_CommandText{CommandText: "echo ok"}}},
|
||||
}
|
||||
for index, spec := range cases {
|
||||
if !errors.Is(spec.Validate(), ErrInvalidStartSpec) {
|
||||
t.Fatalf("case %d validation = %v, want ErrInvalidStartSpec", index, spec.Validate())
|
||||
}
|
||||
}
|
||||
valid := StartSpec{IssueUUID: issue, CommandRevision: 1, Execution: &rvboxv1.ExecutionSpec{Source: &rvboxv1.ExecutionSpec_CommandText{CommandText: "echo ok"}}, WorkingDirectory: `C:\work`}
|
||||
if err := valid.Validate(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user