コード例 #1
0
ファイル: disk_test.go プロジェクト: usmanismail/machine
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
ファイル: manager.go プロジェクト: bboreham/discovery
	"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