diff --git a/libmachine/mcnutils/utils_test.go b/libmachine/mcnutils/utils_test.go index b7693382dd..036e2b72f4 100644 --- a/libmachine/mcnutils/utils_test.go +++ b/libmachine/mcnutils/utils_test.go @@ -67,3 +67,35 @@ func TestGetUsername(t *testing.T) { t.Fatalf("expected username %s; received %s", currentUser, username) } } + +func TestGenerateRandomID(t *testing.T) { + id := GenerateRandomID() + + if len(id) != 64 { + t.Fatalf("Id returned is incorrect: %s", id) + } +} + +func TestShortenId(t *testing.T) { + id := GenerateRandomID() + truncID := TruncateID(id) + if len(truncID) != 12 { + t.Fatalf("Id returned is incorrect: truncate on %s returned %s", id, truncID) + } +} + +func TestShortenIdEmpty(t *testing.T) { + id := "" + truncID := TruncateID(id) + if len(truncID) > len(id) { + t.Fatalf("Id returned is incorrect: truncate on %s returned %s", id, truncID) + } +} + +func TestShortenIdInvalid(t *testing.T) { + id := "1234" + truncID := TruncateID(id) + if len(truncID) != len(id) { + t.Fatalf("Id returned is incorrect: truncate on %s returned %s", id, truncID) + } +} diff --git a/mk/build.mk b/mk/build.mk index bc63b48c44..9f0674f574 100644 --- a/mk/build.mk +++ b/mk/build.mk @@ -6,7 +6,7 @@ build-simple: $(PREFIX)/bin/$(PKG_NAME) # XXX building with -a fails in debug (with -N -l) ???? $(PREFIX)/bin/$(PKG_NAME): $(shell find . -type f -name '*.go') - go build -o $@ $(VERBOSE_GO) -tags "$(BUILDTAGS)" -ldflags "$(GO_LDFLAGS)" $(GO_GCFLAGS) ./main.go + @go build -o $@ $(VERBOSE_GO) -tags "$(BUILDTAGS)" -ldflags "$(GO_LDFLAGS)" $(GO_GCFLAGS) ./main.go # Cross-build: careful, does always rebuild! build-x: clean diff --git a/test/integration/core/core-commands.bats b/test/integration/core/core-commands.bats index 3010e3b702..a654225eae 100644 --- a/test/integration/core/core-commands.bats +++ b/test/integration/core/core-commands.bats @@ -23,7 +23,7 @@ load ${BASE_TEST_DIR}/helpers.bash } @test "$DRIVER: has status 'started' appearing in ls" { - run machine ls --filter state=Running + run machine ls -q --filter state=Running echo ${output} [ "$status" -eq 0 ] [[ ${lines[0]} == "$NAME" ]] @@ -32,7 +32,7 @@ load ${BASE_TEST_DIR}/helpers.bash @test "$DRIVER: create with same name again fails" { run machine create -d $DRIVER $NAME echo ${output} - [ "$status" -eq 0 ] + [ "$status" -eq 1 ] [[ ${lines[0]} == "Error creating machine: Machine $NAME already exists" ]] }