docker_test_vars.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. volumesConfigPath = dockerBasePath + "/volumes"
  16. volumesStoragePath = dockerBasePath + "/vfs/dir"
  17. containerStoragePath = dockerBasePath + "/containers"
  18. runtimePath = "/var/run/docker"
  19. execDriverPath = runtimePath + "/execdriver/native"
  20. workingDirectory string
  21. )
  22. func init() {
  23. if dockerBin := os.Getenv("DOCKER_BINARY"); dockerBin != "" {
  24. dockerBinary = dockerBin
  25. }
  26. var err error
  27. dockerBinary, err = exec.LookPath(dockerBinary)
  28. if err != nil {
  29. fmt.Printf("ERROR: couldn't resolve full path to the Docker binary (%v)", err)
  30. os.Exit(1)
  31. }
  32. if registryImage := os.Getenv("REGISTRY_IMAGE"); registryImage != "" {
  33. registryImageName = registryImage
  34. }
  35. if registry := os.Getenv("REGISTRY_URL"); registry != "" {
  36. privateRegistryURL = registry
  37. }
  38. workingDirectory, _ = os.Getwd()
  39. }