{"modulePath":"github.com/hyperhq/hypercli","version":"v1.10.16","isLatest":true,"isStandardLibrary":false,"goos":"linux","goarch":"amd64","docs":"# package main\n\n## Constants\n\n```go\nconst (\n\t// WindowsBaseImage is the name of the base image for Windows testing\n\tWindowsBaseImage = \"windowsservercore\"\n\n\t// DefaultImage is the name of the base image for the majority of tests that\n\t// are run across suites\n\tDefaultImage = \"busybox\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\tDaemonIsWindows = testRequirement{\n\t\tfunc() bool { return daemonPlatform == \"windows\" },\n\t\t\"Test requires a Windows daemon\",\n\t}\n\tDaemonIsLinux = testRequirement{\n\t\tfunc() bool { return daemonPlatform == \"linux\" },\n\t\t\"Test requires a Linux daemon\",\n\t}\n\tNotArm = testRequirement{\n\t\tfunc() bool { return os.Getenv(\"DOCKER_ENGINE_GOARCH\") != \"arm\" },\n\t\t\"Test requires a daemon not running on ARM\",\n\t}\n\tSameHostDaemon = testRequirement{\n\t\tfunc() bool { return isLocalDaemon },\n\t\t\"Test requires docker daemon to run on the same machine as CLI\",\n\t}\n\tUnixCli = testRequirement{\n\t\tfunc() bool { return isUnixCli },\n\t\t\"Test requires posix utilities or functionality to run.\",\n\t}\n\tExecSupport = testRequirement{\n\t\tfunc() bool { return supportsExec },\n\t\t\"Test requires 'docker exec' capabilities on the tested daemon.\",\n\t}\n\tNetwork = testRequirement{\n\t\tfunc() bool {\n\t\t\t// Set a timeout on the GET at 15s\n\t\t\tvar timeout = time.Duration(15 * time.Second)\n\t\t\tvar url = \"https://hub.docker.com\"\n\n\t\t\tclient := http.Client{\n\t\t\t\tTimeout: timeout,\n\t\t\t}\n\n\t\t\tresp, err := client.Get(url)\n\t\t\tif err != nil \u0026\u0026 strings.Contains(err.Error(), \"use of closed network connection\") {\n\t\t\t\tpanic(fmt.Sprintf(\"Timeout for GET request on %s\", url))\n\t\t\t}\n\t\t\tif resp != nil {\n\t\t\t\tresp.Body.Close()\n\t\t\t}\n\t\t\treturn err == nil\n\t\t},\n\t\t\"Test requires network availability, environment variable set to none to run in a non-network enabled mode.\",\n\t}\n\tApparmor = testRequirement{\n\t\tfunc() bool {\n\t\t\tbuf, err := ioutil.ReadFile(\"/sys/module/apparmor/parameters/enabled\")\n\t\t\treturn err == nil \u0026\u0026 len(buf) \u003e 1 \u0026\u0026 buf[0] == 'Y'\n\t\t},\n\t\t\"Test requires apparmor is enabled.\",\n\t}\n\tRegistryHosting = testRequirement{\n\t\tfunc() bool {\n\n\t\t\t_, err := exec.LookPath(v2binary)\n\t\t\treturn err == nil\n\t\t},\n\t\tfmt.Sprintf(\"Test requires an environment that can host %s in the same host\", v2binary),\n\t}\n\tNotaryHosting = testRequirement{\n\t\tfunc() bool {\n\n\t\t\t_, err := exec.LookPath(notaryBinary)\n\t\t\treturn err == nil\n\t\t},\n\t\tfmt.Sprintf(\"Test requires an environment that can host %s in the same host\", notaryBinary),\n\t}\n\tNotOverlay = testRequirement{\n\t\tfunc() bool {\n\t\t\tcmd := exec.Command(\"grep\", \"^overlay / overlay\", \"/proc/mounts\")\n\t\t\tif err := cmd.Run(); err != nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\t\"Test requires underlying root filesystem not be backed by overlay.\",\n\t}\n\tIPv6 = testRequirement{\n\t\tfunc() bool {\n\t\t\tcmd := exec.Command(\"test\", \"-f\", \"/proc/net/if_inet6\")\n\n\t\t\tif err := cmd.Run(); err != nil {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\t\"Test requires support for IPv6\",\n\t}\n\tNotGCCGO = testRequirement{\n\t\tfunc() bool {\n\t\t\tout, err := exec.Command(\"go\", \"version\").Output()\n\t\t\tif err == nil \u0026\u0026 strings.Contains(string(out), \"gccgo\") {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t\t\"Test requires native Golang compiler instead of GCCGO\",\n\t}\n\tNotUserNamespace = testRequirement{\n\t\tfunc() bool {\n\t\t\troot := os.Getenv(\"DOCKER_REMAP_ROOT\")\n\t\t\tif root != \"\" {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t\t\"Test cannot be run when remapping root\",\n\t}\n)\n```\nList test requirements\n\n```go\nvar (\n\t// SysInfo stores information about which features a kernel supports.\n\tSysInfo *sysinfo.SysInfo\n)\n```\n\n## Types\n\n```go\ntype Daemon struct {\n\t// Defaults to \"daemon\"\n\t// Useful to set to --daemon or -d for checking backwards compatibility\n\tCommand     string\n\tGlobalFlags []string\n\t// contains filtered or unexported fields\n}\n```\nDaemon represents a Docker daemon for the testing framework.\n\n```go\nfunc NewDaemon(c *check.C) *Daemon\n```\nNewDaemon returns a Daemon instance to be used for testing. This will create a directory such as d123456789 in the folder specified by $DEST. The daemon will not automatically start.\n\n```go\nfunc (d *Daemon) Cmd(name string, arg ...string) (string, error)\n```\nCmd will execute a docker CLI command against this Daemon. Example: d.Cmd(\"version\") will run docker --region unix://path/to/unix.sock version\n\n```go\nfunc (d *Daemon) CmdWithArgs(daemonArgs []string, name string, arg ...string) (string, error)\n```\nCmdWithArgs will execute a docker CLI command against a daemon with the given additional arguments\n\n```go\nfunc (d *Daemon) LogFileName() string\n```\nLogFileName returns the path the the daemon's log file\n\n```go\nfunc (d *Daemon) Restart(arg ...string) error\n```\nRestart will restart the daemon by first stopping it and then starting it.\n\n```go\nfunc (d *Daemon) Start(args ...string) error\n```\nStart will start the daemon and return once it is ready to receive requests. You can specify additional daemon flags.\n\n```go\nfunc (d *Daemon) StartWithBusybox(arg ...string) error\n```\nStartWithBusybox will first start the daemon with Daemon.Start() then save the busybox image from the main daemon and load it into this Daemon instance.\n\n```go\nfunc (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error\n```\nStartWithLogFile will start the daemon and attach its streams to a given file.\n\n```go\nfunc (d *Daemon) Stop() error\n```\nStop will send a SIGINT every second and wait for the daemon to stop. If it timeouts, a SIGKILL is sent. Stop will not delete the daemon directory. If a purged daemon is needed, instantiate a new one with NewDaemon.\n\n```go\ntype FakeContext struct {\n\tDir string\n}\n```\nFakeContext creates directories that can be used as a build context\n\n```go\nfunc (f *FakeContext) Add(file, content string) error\n```\nAdd a file at a path, creating directories where necessary\n\n```go\nfunc (f *FakeContext) Close() error\n```\nClose deletes the context\n\n```go\nfunc (f *FakeContext) Delete(file string) error\n```\nDelete a file at a path\n\n```go\ntype FakeStorage interface {\n\tClose() error\n\tURL() string\n\tCtxDir() string\n}\n```\nFakeStorage is a static file server. It might be running locally or remotely on test host.\n\n","path":"github.com/hyperhq/hypercli/integration-cli","name":"main","synopsis":"","isRedistributable":true}
