docker_test_vars.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. "os/exec"
  6. )
  7. var (
  8. // the docker binary to use
  9. dockerBinary = "docker"
  10. // the private registry image to use for tests involving the registry
  11. registryImageName = "registry"
  12. // the private registry to use for tests
  13. privateRegistryURL = "127.0.0.1:5000"
  14. dockerBasePath = "/var/lib/docker"
  15. execDriverPath = dockerBasePath + "/execdriver/native"
  16. volumesConfigPath = dockerBasePath + "/volumes"
  17. volumesStoragePath = dockerBasePath + "/vfs/dir"
  18. containerStoragePath = dockerBasePath + "/containers"
  19. workingDirectory string
  20. )
  21. func init() {
  22. if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" {
  23. dockerBinary = dockerBin
  24. }
  25. var err error
  26. dockerBinary, err = exec.LookPath(dockerBinary)
  27. if err != nil {
  28. fmt.Printf("ERROR: couldn't resolve full path to the Docker binary (%v)", err)
  29. os.Exit(1)
  30. }
  31. if registryImage := os.Getenv("REGISTRY_IMAGE"); registryImage != "" {
  32. registryImageName = registryImage
  33. }
  34. if registry := os.Getenv("REGISTRY_URL"); registry != "" {
  35. privateRegistryURL = registry
  36. }
  37. workingDirectory, _ = os.Getwd()
  38. }