Example #1
0
func init() {
	check.Suite(&SimpleSuite{})
	check.Suite(&AccessLogSuite{})
	check.Suite(&HTTPSSuite{})
	check.Suite(&FileSuite{})
	check.Suite(&DockerSuite{})
	check.Suite(&ConsulSuite{})
	check.Suite(&ConsulCatalogSuite{})
	check.Suite(&EtcdSuite{})
	check.Suite(&MarathonSuite{})
	check.Suite(&ConstraintSuite{})
}
func init() {
	// FIXME. Temporarily turning this off for Windows as GH16039 was breaking
	// Windows to Linux CI @icecrime
	if runtime.GOOS != "windows" {
		check.Suite(newDockerHubPullSuite())
	}
}
Example #3
0
func init() {
	ds := &DockerSuite{}
	check.Suite(&DockerTrustedSwarmSuite{
		trustSuite: DockerTrustSuite{
			ds: ds,
		},
		swarmSuite: DockerSwarmSuite{
			ds: ds,
		},
	})
}
Example #4
0
func init() {
	check.Suite(&DockerSchema1RegistrySuite{
		ds: &DockerSuite{},
	})
}
Example #5
0
func init() {
	check.Suite(&DockerTrustSuite{
		ds: &DockerSuite{},
	})
}
Example #6
0
func init() {
	check.Suite(&DockerDaemonSuite{
		ds: &DockerSuite{},
	})
}
func init() {
	check.Suite(&DockerAuthzSuite{
		ds: &DockerSuite{},
	})
}
func init() {
	check.Suite(&DockerExternalVolumeSuite{
		ds: &DockerSuite{},
	})
}
func init() {
	check.Suite(&CheckersS{})
}
Example #10
0
func init() {
	check.Suite(&ContainerdSuite{lastEventTs: uint64(time.Now().Unix())})
}
Example #11
0
func init() {
	check.Suite(&StringCheckerS{})
}
Example #12
0
func init() {
	check.Suite(&BoolCheckerS{})
}
func (handler denyingDeaHandler) ServeHTTP(w http.ResponseWriter,
	r *http.Request) {
	if !checkRequest(r, handler.expRequest) {
		handler.t.Fail()
	}

	w.Header().Set("Content-Length", strconv.
		Itoa(len(*(handler.responseBody))))
	w.WriteHeader(400)
	w.Write(*(handler.responseBody))
}

type DirectoryServerSuite struct{}

var _ = check.Suite(&DirectoryServerSuite{})

func (s *DirectoryServerSuite) TestHandler_ServeHTTP_RequestToDeaFailed(t *check.C) {
	lc, hc, pc := startTestServer(http.NotFoundHandler())
	lc.Close()

	h := handler{
		deaHost:          hc,
		deaPort:          pc,
		streamingTimeout: 1,
		deaClient:        &DeaClient{Host: hc, Port: pc},
	}

	ld, hd, pd := startTestServer(h)
	defer ld.Close()
Example #14
0
func init() {
	check.Suite(&ContainerdSuite{})
}
Example #15
0
func init() {
	check.Suite(&TimeCheckerS{})
}
func init() {
	check.Suite(&DockerNetworkSuite{
		ds: &DockerSuite{},
	})
}
	"testing"

	"github.com/go-check/check"
)

func Test(t *testing.T) {
	check.TestingT(t)
}

func init() {
	check.Suite(&CheckersS{})
}

type CheckersS struct{}

var _ = check.Suite(&CheckersS{})

func testInfo(c *check.C, checker check.Checker, name string, paramNames []string) {
	info := checker.Info()
	if info.Name != name {
		c.Fatalf("Got name %s, expected %s", info.Name, name)
	}
	if !reflect.DeepEqual(info.Params, paramNames) {
		c.Fatalf("Got param names %#v, expected %#v", info.Params, paramNames)
	}
}

func testCheck(c *check.C, checker check.Checker, expectedResult bool, expectedError string, params ...interface{}) ([]interface{}, []string) {
	info := checker.Info()
	if len(params) != len(info.Params) {
		c.Fatalf("unexpected param count in test; expected %d got %d", len(info.Params), len(params))
Example #18
0
	"golang.org/x/net/context"

	"github.com/docker/engine-api/client"
	"github.com/docker/engine-api/types"
	"github.com/docker/engine-api/types/filters"
	"github.com/go-check/check"
	compose "github.com/vdemeester/libkermit/compose/check"
	"github.com/vdemeester/libkermit/docker"
)

// Hook up gocheck into the "go test" runner
func Test(t *testing.T) { check.TestingT(t) }

type CheckSuite struct{}

var _ = check.Suite(&CheckSuite{})

func (s *CheckSuite) TestSimpleProject(c *check.C) {
	project := compose.CreateProject(c, "simple", "../assets/simple.yml")
	project.Start(c)

	// FIXME(vdemeester) check that a container is running
	runningContainers, err := findContainersForProject("simple")
	c.Assert(err, check.IsNil)
	c.Assert(len(runningContainers), check.Equals, 1,
		check.Commentf("Expected 1 running container for this project, got %v", runningContainers))

	project.Stop(c)
}

func findContainersForProject(name string) ([]types.Container, error) {
Example #19
0
package nodes

import (
	"testing"

	"github.com/docker/docker/pkg/discovery"

	"github.com/go-check/check"
)

// Hook up gocheck into the "go test" runner.
func Test(t *testing.T) { check.TestingT(t) }

type DiscoverySuite struct{}

var _ = check.Suite(&DiscoverySuite{})

func (s *DiscoverySuite) TestInitialize(c *check.C) {
	d := &Discovery{}
	d.Initialize("1.1.1.1:1111,2.2.2.2:2222", 0, 0, nil)
	c.Assert(len(d.entries), check.Equals, 2)
	c.Assert(d.entries[0].String(), check.Equals, "1.1.1.1:1111")
	c.Assert(d.entries[1].String(), check.Equals, "2.2.2.2:2222")
}

func (s *DiscoverySuite) TestInitializeWithPattern(c *check.C) {
	d := &Discovery{}
	d.Initialize("1.1.1.[1:2]:1111,2.2.2.[2:4]:2222", 0, 0, nil)
	c.Assert(len(d.entries), check.Equals, 5)
	c.Assert(d.entries[0].String(), check.Equals, "1.1.1.1:1111")
	c.Assert(d.entries[1].String(), check.Equals, "1.1.1.2:1111")
	"io/ioutil"
	"net"
	"net/http"
	"os"
	"path/filepath"
	"time"

	"github.com/go-check/check"
)

type StreamHandlerSuite struct {
	FileName string
	Handler  *StreamHandler
}

var _ = check.Suite(&StreamHandlerSuite{})

func (s *StreamHandlerSuite) SetUpTest(c *check.C) {
	s.FileName = s.TempFileName(c)
}

func (s *StreamHandlerSuite) TearDownTest(c *check.C) {
	os.Remove(s.FileName)

	if s.Handler != nil {
		s.Handler = nil
	}
}

func (s *StreamHandlerSuite) Printf(c *check.C, format string, a ...interface{}) {
	f, err := os.OpenFile(s.FileName, os.O_RDWR|os.O_APPEND, 0600)
Example #21
0
func init() {
	check.Suite(&SkopeoSuite{})
}
Example #22
0
			Resources: &specs.Resources{},
		},
	}
)

func Test(t *testing.T) { check.TestingT(t) }

type RunVSuite struct {
	binaryPath string
	kernelPath string
	initrdPath string
	bundlePath string
	configPath string
}

var _ = check.Suite(&RunVSuite{})

func (s *RunVSuite) SetUpSuite(c *check.C) {
	var err error
	s.binaryPath, err = exec.LookPath(binaryName)
	c.Assert(err, checker.IsNil)

	// Prepare bundle and rootfs
	s.bundlePath = c.MkDir()
	rootfs := filepath.Join(s.bundlePath, rootfsName)
	err = os.Mkdir(rootfs, 777)
	c.Assert(err, checker.IsNil)

	// untar busybox image tar file into bundle/rootfs dir
	busyboxTarPath := filepath.Join(testDataDir, busyboxTarName)
	_, err = os.Stat(busyboxTarPath)
Example #23
0
func init() {
	check.Suite(&DockerRegistryAuthTokenSuite{
		ds: &DockerSuite{},
	})
}
Example #24
0
	check.TestingT(t)
}

type MySuite struct {
	common.RomanaTestSuite
	serviceURL  string
	servicePort uint64
	kubeURL     string
	c           *check.C
}

func (s *MySuite) TearDownSuite(c *check.C) {
	s.RomanaTestSuite.CleanUp()
}

var _ = check.Suite(&MySuite{})

// mockSvc is a Romana Service used in tests.
type mockSvc struct {
	mySuite *MySuite
	// To simulate tenant/segment database.
	// tenantCounter will provide tenant IDs
	tenantCounter uint64
	// Map of tenant ID to external ID
	tenants map[uint64]string
	// Map of External ID to tenant ID
	tenantsStr     map[string]uint64
	segmentCounter uint64
	segments       map[uint64]string
	segmentsStr    map[string]uint64
}
Example #25
0
func init() {
	check.Suite(&DockerSwarmSuite{
		ds: &DockerSuite{},
	})
}
func init() {
	check.Suite(newDockerHubPullSuite())
}
Example #27
0
func init() {
	check.Suite(&DockerSuite{})
}
func init() {
	check.Suite(&DockerExternalGraphdriverSuite{
		ds: &DockerSuite{},
	})
}
Example #29
0
func init() {
	check.Suite(&DockerRegistryAuthHtpasswdSuite{
		ds: &DockerSuite{},
	})
}
Example #30
0
func init() {
	check.Suite(&CommonCheckerS{})
}