-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_test.go
More file actions
58 lines (48 loc) · 1.07 KB
/
run_test.go
File metadata and controls
58 lines (48 loc) · 1.07 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
package sooslib
import (
"testing"
)
func TestBuildRunCmd(t *testing.T) {
userCurrent = userCurrentMock
osGetwd = osGetwdMock
want := `docker run -it -u 0:0 -v /test:/test -v /root:/build/app -p 5000:5000 soos-build:eac1fbb9986eacd640fdb306d599cb29e2b2db4a`
buildConfig := BuildConfig{
Build: ".",
Image: "soos-build",
Ports: []string{"5000:5000"},
Volumes: []string{"/test:/test"},
Hashfiles: []string{"resources/package.json"},
}
got := BuildRunCmd(buildConfig)
if got != want {
t.Errorf("BuildRunCmd(%q) == %q, want %q", buildConfig, got, want)
}
}
func Test_execCmd(t *testing.T) {
type args struct {
cmdString string
}
tests := []struct {
name string
args args
want bool
}{
{
name: "simple",
args: args{cmdString: "echo test"},
want: true,
},
{
name: "empty",
args: args{cmdString: "echo -n"},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := ExecCmd(tt.args.cmdString); got != tt.want {
t.Errorf("execCmd() = %v, want %v", got, tt.want)
}
})
}
}