Ejemplo n.º 1
0
	"net"

	"github.com/Sirupsen/logrus"
	"github.com/ice-stuff/clique/api"
	"github.com/ice-stuff/clique/dispatcher"
	"github.com/ice-stuff/clique/dispatcher/fakes"
	"github.com/ice-stuff/clique/transfer"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("Dispatcher", func() {
	var (
		fakeScheduler             *fakes.FakeScheduler
		fakeTransferInterruptible *fakes.FakeInterruptible
		fakeTransferClient        *fakes.FakeTransferClient
		fakeApiRegistry           *fakes.FakeApiRegistry
		logger                    *logrus.Logger
		dsptchr                   *dispatcher.Dispatcher
	)

	BeforeEach(func() {
		fakeScheduler = new(fakes.FakeScheduler)
		fakeApiRegistry = new(fakes.FakeApiRegistry)
		logger = &logrus.Logger{
			Out:       GinkgoWriter,
			Level:     logrus.DebugLevel,
			Formatter: new(logrus.TextFormatter),
		}

		dsptchr = &dispatcher.Dispatcher{
			Scheduler: fakeScheduler,
Ejemplo n.º 2
0
	"github.com/Sirupsen/logrus"
	"github.com/ice-stuff/clique/api"
	"github.com/ice-stuff/clique/dispatcher"
	"github.com/ice-stuff/clique/dispatcher/fakes"
	"github.com/ice-stuff/clique/scheduler"
	"github.com/ice-stuff/clique/transfer"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
)

var _ = Describe("TransferTask", func() {
	var (
		t                         *dispatcher.TransferTask
		fakeTransferInterruptible *fakes.FakeInterruptible
		fakeTransferClient        *fakes.FakeTransferClient
		transferSpec              transfer.TransferSpec
		fakeRegistry              *fakes.FakeApiRegistry
		priority                  int
		logger                    *logrus.Logger
	)

	BeforeEach(func() {
		fakeTransferInterruptible = new(fakes.FakeInterruptible)
		fakeTransferClient = new(fakes.FakeTransferClient)
		transferSpec = transfer.TransferSpec{
			IP:   net.ParseIP("92.168.12.19"),
			Port: 1245,
			Size: 10 * 1024 * 1024,
		}
		fakeRegistry = new(fakes.FakeApiRegistry)
		priority = 10