forked from keploy/keploy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreexec_linux_test.go
More file actions
72 lines (68 loc) · 1.5 KB
/
Copy pathreexec_linux_test.go
File metadata and controls
72 lines (68 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
//go:build linux
package utils
import "testing"
func TestIsCloudReplayCmd(t *testing.T) {
tests := []struct {
name string
args []string
want bool
}{
{
name: "cloud replay",
args: []string{"keploy", "cloud", "replay"},
want: true,
},
{
name: "cloud replay with flags",
args: []string{"keploy", "cloud", "replay", "--verbose"},
want: true,
},
{
name: "persistent flag before subcommands",
args: []string{"keploy", "--debug", "cloud", "replay"},
want: true,
},
{
name: "persistent flag between cloud and replay",
args: []string{"keploy", "cloud", "--debug", "replay"},
want: true,
},
{
name: "flag with value between cloud and replay",
args: []string{"keploy", "cloud", "--config", "/tmp/cfg", "replay"},
want: true,
},
{
name: "flag with inline value between cloud and replay",
args: []string{"keploy", "cloud", "--config=/tmp/cfg", "replay"},
want: true,
},
{
name: "cloud without replay",
args: []string{"keploy", "cloud", "record"},
want: false,
},
{
name: "only cloud",
args: []string{"keploy", "cloud"},
want: false,
},
{
name: "replay without cloud",
args: []string{"keploy", "replay"},
want: false,
},
{
name: "no subcommand",
args: []string{"keploy"},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := isCloudReplayCmd(tt.args); got != tt.want {
t.Errorf("isCloudReplayCmd(%v) = %v, want %v", tt.args, got, tt.want)
}
})
}
}