From 2801e7d1e10bbc4b7729beeb7a58b93ead3f636e Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Tue, 6 Oct 2015 16:33:02 -0700 Subject: [PATCH] Fingerprint test should now behave correctly when the executor is not installed; fix some go vet issues --- client/driver/docker.go | 2 +- client/driver/docker_test.go | 10 +++++----- client/driver/java_test.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/driver/docker.go b/client/driver/docker.go index 7f59e7ce38c..2b4fdd78edd 100644 --- a/client/driver/docker.go +++ b/client/driver/docker.go @@ -146,7 +146,7 @@ func createContainer(ctx *ExecContext, task *structs.Task, logger *log.Logger) d for _, port := range network.ListStaticPorts() { dockerPorts[docker.Port(strconv.Itoa(port)+"/tcp")] = []docker.PortBinding{docker.PortBinding{HostIP: network.IP, HostPort: strconv.Itoa(port)}} dockerPorts[docker.Port(strconv.Itoa(port)+"/udp")] = []docker.PortBinding{docker.PortBinding{HostIP: network.IP, HostPort: strconv.Itoa(port)}} - logger.Printf("[DEBUG] driver.docker: allocated port %s:%d -> %d (static) %s\n", network.IP, port, port) + logger.Printf("[DEBUG] driver.docker: allocated port %s:%d -> %d (static)\n", network.IP, port, port) } for label, port := range network.MapDynamicPorts() { diff --git a/client/driver/docker_test.go b/client/driver/docker_test.go index e6eab88dc49..6af8e28d1be 100644 --- a/client/driver/docker_test.go +++ b/client/driver/docker_test.go @@ -41,11 +41,11 @@ func TestDockerDriver_Fingerprint(t *testing.T) { if err != nil { t.Fatalf("err: %v", err) } - if !apply { - t.Fatalf("should apply") + if apply != dockerLocated() { + t.Fatalf("Fingerprinter should detect Docker when it is installed") } if node.Attributes["driver.docker"] == "" { - t.Fatalf("Docker not found. The remainder of the docker tests will be skipped.") + t.Log("Docker not found. The remainder of the docker tests will be skipped.") } t.Logf("Found docker version %s", node.Attributes["driver.docker.version"]) } @@ -217,7 +217,7 @@ func TestDocker_StartN(t *testing.T) { handles := make([]DriverHandle, len(taskList)) - t.Log("==> Starting %d tasks", len(taskList)) + t.Logf("==> Starting %d tasks", len(taskList)) // Let's spin up a bunch of things var err error @@ -266,7 +266,7 @@ func TestDocker_StartNVersions(t *testing.T) { handles := make([]DriverHandle, len(taskList)) - t.Log("==> Starting %d tasks", len(taskList)) + t.Logf("==> Starting %d tasks", len(taskList)) // Let's spin up a bunch of things var err error diff --git a/client/driver/java_test.go b/client/driver/java_test.go index aa4752e9523..f73c9569235 100644 --- a/client/driver/java_test.go +++ b/client/driver/java_test.go @@ -28,8 +28,8 @@ func TestJavaDriver_Fingerprint(t *testing.T) { if err != nil { t.Fatalf("err: %v", err) } - if !apply { - t.Fatalf("should apply") + if apply != javaLocated() { + t.Fatalf("Fingerprinter should detect Java when it is installed") } if node.Attributes["driver.java"] != "1" { t.Fatalf("missing driver")