feat: implement control history and mutation APIs
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
rvboxv1 "github.com/rvbox/rvbox/gen/go/rvbox/v1"
|
||||
)
|
||||
|
||||
func TestGlobalSocketAndCLIValueParsing_HP_CTL_11(t *testing.T) {
|
||||
socket, args, err := globalSocket([]string{"--socket", filepath.Join(t.TempDir(), "rvbox.sock"), "run", "client", "echo"})
|
||||
if err != nil || args[0] != "run" || socket == "" {
|
||||
t.Fatalf("global socket = %q %#v, %v", socket, args, err)
|
||||
}
|
||||
if _, _, err := globalSocket([]string{"--socket", "relative.sock", "stat"}); err == nil {
|
||||
t.Fatal("relative control socket accepted")
|
||||
}
|
||||
for input, want := range map[string]rvboxv1.ShellType{"sh": rvboxv1.ShellType_SHELL_SH, "bash": rvboxv1.ShellType_SHELL_BASH, "cmd": rvboxv1.ShellType_SHELL_CMD, "pwsh": rvboxv1.ShellType_SHELL_POWERSHELL, "": rvboxv1.ShellType_SHELL_TYPE_UNSPECIFIED} {
|
||||
got, err := parseShell(input)
|
||||
if err != nil || got != want {
|
||||
t.Errorf("parseShell(%q) = %v, %v", input, got, err)
|
||||
}
|
||||
}
|
||||
if _, err := parseProfile("unknown"); err == nil {
|
||||
t.Fatal("unknown profile accepted")
|
||||
}
|
||||
if got := queueDuration(-time.Nanosecond); got != nil {
|
||||
t.Fatal("negative queue duration was encoded")
|
||||
}
|
||||
if got := queueDuration(0); got == nil || got.AsDuration() != 0 {
|
||||
t.Fatalf("zero queue duration = %v", got)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user