traefik/vendor/github.com/libkermit/docker-check/check.go
Vincent Demeester b7daa2f3a4 Update traefik dependencies (docker/docker and related) (#1823)
Update traefik dependencies (docker/docker and related)

- Update dependencies
- Fix compilation problems
- Remove vdemeester/docker-events (in docker api now)
- Remove `integration/vendor`
- Use `testImport`
- update some deps.
- regenerate the lock from scratch (after a `glide cc`)
2017-07-06 16:28:13 +02:00

36 lines
1.1 KiB
Go

// Package docker aims to provide simple "helper" methods to ease the use of
// docker in (integration) tests using the go-check testing package.
//
// It does support a subset of options compared to actual client api, as it
// is more focused on needs for integration tests.
package docker
import (
"github.com/go-check/check"
"github.com/docker/docker/client"
"github.com/libkermit/docker"
)
// Project holds docker related project attributes, like docker client, labels
// to put on the containers, and so on.
type Project struct {
project *docker.Project
}
// NewProjectFromEnv creates a project with a client that is build from environment variables.
func NewProjectFromEnv(c *check.C) *Project {
client, err := client.NewEnvClient()
c.Assert(err, check.IsNil, check.Commentf("Error while getting a docker client from env"))
return NewProject(client)
}
// NewProject creates a project with the given client and the default attributes.
func NewProject(client client.APIClient) *Project {
return &Project{
project: &docker.Project{
Client: client,
Labels: docker.KermitLabels,
},
}
}