Skip to content

Commit 9aeaaec

Browse files
committed
Basic testing for 'run' command
1 parent 8654b62 commit 9aeaaec

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

pkg/cli/run_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package cli
2+
3+
import (
4+
"fmt"
5+
"testing"
6+
7+
. "github.com/scaleway/scaleway-cli/vendor/github.com/smartystreets/goconvey/convey"
8+
)
9+
10+
func TestRunRun(t *testing.T) {
11+
Convey("Testing runRun", t, func() {
12+
cmdRun.Flag.Parse([]string{"-a", "-d"})
13+
rawArgs := []string{"my-server"}
14+
So(runRun(cmdRun, rawArgs), ShouldResemble, fmt.Errorf("conflicting options: -a and -d"))
15+
runAttachFlag = false
16+
runDetachFlag = false
17+
18+
cmdRun.Flag.Parse([]string{"-a"})
19+
rawArgs = []string{"my-server", "my-command"}
20+
So(runRun(cmdRun, rawArgs), ShouldResemble, fmt.Errorf("conflicting options: -a and COMMAND"))
21+
runAttachFlag = false
22+
23+
cmdRun.Flag.Parse([]string{"-d"})
24+
rawArgs = []string{"my-server", "my-command"}
25+
So(runRun(cmdRun, rawArgs), ShouldResemble, fmt.Errorf("conflicting options: -d and COMMAND"))
26+
runDetachFlag = false
27+
28+
cmdRun.Flag.Parse([]string{"-d", "--rm"})
29+
rawArgs = []string{"my-server"}
30+
So(runRun(cmdRun, rawArgs), ShouldResemble, fmt.Errorf("conflicting options: --detach and --rm"))
31+
})
32+
}

0 commit comments

Comments
 (0)