bugfix: fix arvados-node-manager package build
[arvados.git] / lib / controller / localdb / login_ldap_docker_test.go
index 2f0d22075f59b58cccc2ca71ab536690e8ca0328..79b5f16158ab0c39cba73822cb534bd9303ce24c 100644 (file)
@@ -2,19 +2,28 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-// Skip this slow test unless invoked as "go test -tags docker".
-// +build docker
-
 package localdb
 
 import (
        "os"
        "os/exec"
+       "testing"
 
        check "gopkg.in/check.v1"
 )
 
+func haveDocker() bool {
+       _, err := exec.Command("docker", "info").CombinedOutput()
+       return err == nil
+}
+
 func (s *LDAPSuite) TestLoginLDAPViaPAM(c *check.C) {
+       if testing.Short() {
+               c.Skip("skipping docker test in short mode")
+       }
+       if !haveDocker() {
+               c.Skip("skipping docker test because docker is not available")
+       }
        cmd := exec.Command("bash", "login_ldap_docker_test.sh")
        cmd.Stdout = os.Stderr
        cmd.Stderr = os.Stderr
@@ -24,6 +33,12 @@ func (s *LDAPSuite) TestLoginLDAPViaPAM(c *check.C) {
 }
 
 func (s *LDAPSuite) TestLoginLDAPBuiltin(c *check.C) {
+       if testing.Short() {
+               c.Skip("skipping docker test in short mode")
+       }
+       if !haveDocker() {
+               c.Skip("skipping docker test because docker is not available")
+       }
        cmd := exec.Command("bash", "login_ldap_docker_test.sh")
        cmd.Stdout = os.Stderr
        cmd.Stderr = os.Stderr