-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandler_test.go
33 lines (23 loc) · 954 Bytes
/
handler_test.go
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
package main
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestDockerRunHandler_BuildCommand(t *testing.T) {
want := []string{"docker", "run", "-it", "--rm", "test", "-p ", "8080:80", "-v ", "./:/opt/", "ls -la"}
dockerRunHandler := &DockerRunHandler{true, "test", "8080:80", []string{"./:/opt/"}}
got := dockerRunHandler.BuildCommand([]string{"ls -la"})
assert.Equal(t, want, got)
}
func TestComposeExecHandler_BuildCommand(t *testing.T) {
want := []string{"docker-compose", "exec", "gotest", "ls -la"}
composeExecHandler := &ComposeExecHandler{"gotest"}
got := composeExecHandler.BuildCommand([]string{"ls -la"})
assert.Equal(t, want, got)
}
func TestComposeRunHandler_BuildCommand(t *testing.T) {
want := []string{"docker-compose", "run", "--rm", "gotest", "ls -la"}
composeRunHandler := &ComposeRunHandler{true, "gotest"}
got := composeRunHandler.BuildCommand([]string{"ls -la"})
assert.Equal(t, want, got)
}