From 3287c3f019a616af5fa02f8dc4ca4e0dd6a2c451 Mon Sep 17 00:00:00 2001 From: Danielle Tomlinson Date: Wed, 16 Jan 2019 15:06:39 +0100 Subject: [PATCH] chore: General Cleanup --- drivers/docker/docklog/docker_logger_test.go | 2 +- drivers/docker/driver_windows_test.go | 1 + plugins/shared/loader/init.go | 8 +++----- plugins/shared/loader/loader_test.go | 2 +- testutil/vault.go | 3 ++- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/docker/docklog/docker_logger_test.go b/drivers/docker/docklog/docker_logger_test.go index 24e90cb69..22c3dea8c 100644 --- a/drivers/docker/docklog/docker_logger_test.go +++ b/drivers/docker/docklog/docker_logger_test.go @@ -14,7 +14,7 @@ import ( "golang.org/x/net/context" ) -func testContainerDetails() (string, string, string) { +func testContainerDetails() (image string, imageName string, imageTag string) { if runtime.GOOS == "windows" { return "dantoml/busybox-windows:08012019", "dantoml/busybox-windows", diff --git a/drivers/docker/driver_windows_test.go b/drivers/docker/driver_windows_test.go index cc2efed8c..ffec23a5f 100644 --- a/drivers/docker/driver_windows_test.go +++ b/drivers/docker/driver_windows_test.go @@ -21,5 +21,6 @@ func newTaskConfig(variant string, command []string) TaskConfig { } } +// No-op on windows because we don't load images. func copyImage(t *testing.T, taskDir *allocdir.TaskDir, image string) { } diff --git a/plugins/shared/loader/init.go b/plugins/shared/loader/init.go index 127fea4c5..2795656a4 100644 --- a/plugins/shared/loader/init.go +++ b/plugins/shared/loader/init.go @@ -255,11 +255,9 @@ func (l *PluginLoader) scan() ([]os.FileInfo, error) { // extension and the file begins with MZ, however, there is no easy way for us to // actually validate the executability of a file, so here we skip executability checks // for windows systems. - if runtime.GOOS != "windows" { - if runtime.GOOS != "windows" && s.Mode().Perm()&0111 == 0 { - l.logger.Debug("skipping un-executable file in plugin folder", "file", f) - continue - } + if runtime.GOOS != "windows" && s.Mode().Perm()&0111 == 0 { + l.logger.Debug("skipping un-executable file in plugin folder", "file", f) + continue } plugins = append(plugins, s) } diff --git a/plugins/shared/loader/loader_test.go b/plugins/shared/loader/loader_test.go index 2fd9004d1..0b759de51 100644 --- a/plugins/shared/loader/loader_test.go +++ b/plugins/shared/loader/loader_test.go @@ -61,7 +61,7 @@ func newHarness(t *testing.T, plugins []string) *harness { exeSuffix = ".exe" } for _, p := range plugins { - dest := strings.Join([]string{filepath.Join(h.tmpDir, p), exeSuffix}, "") + dest := filepath.Join(h.tmpDir, p) + exeSuffix if err := copyFile(selfExe, dest); err != nil { t.Fatalf("failed to copy file: %v", err) } diff --git a/testutil/vault.go b/testutil/vault.go index ea377abad..7083f01d6 100644 --- a/testutil/vault.go +++ b/testutil/vault.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/nomad/nomad/structs/config" vapi "github.com/hashicorp/vault/api" testing "github.com/mitchellh/go-testing-interface" + "github.com/stretchr/testify/require" ) // TestVault is a test helper. It uses a fork/exec model to create a test Vault @@ -205,7 +206,7 @@ func (tv *TestVault) Stop() { case <-tv.waitCh: return case <-time.After(1 * time.Second): - tv.t.Error("Timed out waiting for vault to terminate") + require.Fail(tv.t, "Timed out waiting for vault to terminate") } } }