Пример #1
0
func TestVMDiskInfoError(t *testing.T) {
	vbox := &VBoxManagerMock{
		args: "showvminfo default --machinereadable",
		err:  errors.New("BUG"),
	}

	disk, err := getVMDiskInfo("default", vbox)

	assert.Nil(t, disk)
	assert.EqualError(t, err, "BUG")
}
Пример #2
0
func TestCmdVersionFailure(t *testing.T) {
	defer func(versioner mcndockerclient.DockerVersioner) { mcndockerclient.CurrentDockerVersioner = versioner }(mcndockerclient.CurrentDockerVersioner)
	mcndockerclient.CurrentDockerVersioner = &mcndockerclient.FakeDockerVersioner{Err: errors.New("connection failure")}

	commandLine := &commandstest.FakeCommandLine{
		CliArgs: []string{"machine"},
	}
	api := &libmachinetest.FakeAPI{
		Hosts: []*host.Host{
			{
				Name: "machine",
			},
		},
	}

	out := &bytes.Buffer{}
	err := printVersion(commandLine, api, out)

	assert.EqualError(t, err, "connection failure")
}
Пример #3
0
func (f field) Value() (graphql.Value, error) {
	return nil, errors.New("illegal call to Value; not a scalar value")
}
Пример #4
0
	"bytes"
	"fmt"
	"net"
	"time"

	"github.com/docker/machine/drivers/vmwarevsphere/errors"
	"github.com/docker/swarm/discovery"
	_ "github.com/docker/swarm/discovery/file"
	_ "github.com/docker/swarm/discovery/kv"
	_ "github.com/docker/swarm/discovery/nodes"
	_ "github.com/docker/swarm/discovery/token"
	. "github.com/weaveworks/weave/common"
)

var (
	errInvalidEndpoint = errors.New("Invalid endpoint")
)

type discoveryEndpoint struct {
	discovery.Discovery

	url      string
	stopChan chan struct{}

	// stats
	added        uint64
	removed      uint64
	lastRegister time.Time
}

// Create a new endpoint