File tree Expand file tree Collapse file tree 3 files changed +35
-3
lines changed
Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -67,3 +67,35 @@ func TestGetUsername(t *testing.T) {
6767 t .Fatalf ("expected username %s; received %s" , currentUser , username )
6868 }
6969}
70+
71+ func TestGenerateRandomID (t * testing.T ) {
72+ id := GenerateRandomID ()
73+
74+ if len (id ) != 64 {
75+ t .Fatalf ("Id returned is incorrect: %s" , id )
76+ }
77+ }
78+
79+ func TestShortenId (t * testing.T ) {
80+ id := GenerateRandomID ()
81+ truncID := TruncateID (id )
82+ if len (truncID ) != 12 {
83+ t .Fatalf ("Id returned is incorrect: truncate on %s returned %s" , id , truncID )
84+ }
85+ }
86+
87+ func TestShortenIdEmpty (t * testing.T ) {
88+ id := ""
89+ truncID := TruncateID (id )
90+ if len (truncID ) > len (id ) {
91+ t .Fatalf ("Id returned is incorrect: truncate on %s returned %s" , id , truncID )
92+ }
93+ }
94+
95+ func TestShortenIdInvalid (t * testing.T ) {
96+ id := "1234"
97+ truncID := TruncateID (id )
98+ if len (truncID ) != len (id ) {
99+ t .Fatalf ("Id returned is incorrect: truncate on %s returned %s" , id , truncID )
100+ }
101+ }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ build-simple: $(PREFIX)/bin/$(PKG_NAME)
66
77# XXX building with -a fails in debug (with -N -l) ????
88$(PREFIX ) /bin/$(PKG_NAME ) : $(shell find . -type f -name '* .go')
9- go build -o $@ $(VERBOSE_GO ) -tags " $( BUILDTAGS) " -ldflags " $( GO_LDFLAGS) " $(GO_GCFLAGS ) ./main.go
9+ @ go build -o $@ $(VERBOSE_GO ) -tags " $( BUILDTAGS) " -ldflags " $( GO_LDFLAGS) " $(GO_GCFLAGS ) ./main.go
1010
1111# Cross-build: careful, does always rebuild!
1212build-x : clean
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ load ${BASE_TEST_DIR}/helpers.bash
2323}
2424
2525@test " $DRIVER : has status 'started' appearing in ls" {
26- run machine ls --filter state=Running
26+ run machine ls -q - -filter state=Running
2727 echo ${output}
2828 [ " $status " -eq 0 ]
2929 [[ ${lines[0]} == " $NAME " ]]
@@ -32,7 +32,7 @@ load ${BASE_TEST_DIR}/helpers.bash
3232@test " $DRIVER : create with same name again fails" {
3333 run machine create -d $DRIVER $NAME
3434 echo ${output}
35- [ " $status " -eq 0 ]
35+ [ " $status " -eq 1 ]
3636 [[ ${lines[0]} == " Error creating machine: Machine $NAME already exists" ]]
3737}
3838
You can’t perform that action at this time.
0 commit comments