Beispiel #1
0
func CleanupSQL(persister brokerapi.Persister) {
	persister.Connect()
	persister.Db.Exec("delete from serviceagents")
	persister.Db.Exec("delete from servicebindings")
	persister.Db.Exec("delete from serviceinstances")
	persister.Db.Exec("delete from brokerconfigurations")
	persister.Db.Exec("delete from imageconfigurations")
	persister.Db.Exec("delete from serviceconfigurations")
	persister.Db.Exec("delete from brokercertificates")
}
import (
	"github.com/brahmaroutu/docker-broker/broker/brokerapi"
	"github.com/brahmaroutu/docker-broker/broker/dockerapi"
	"github.com/brahmaroutu/docker-broker/broker/testhelpers"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"errors"
	"fmt"
	"time"
)

var _ = Describe("Simpledispatcher", func() {
	var config dockerapi.BrokerConfiguration
	var persister brokerapi.Persister
	var dispatcher brokerapi.DispatcherInterface
	var cm dockerapi.BrokerConfiguration
	var err error
	JustBeforeEach(func() {
		config = testnet.BrokerConfiguration()
		dispatcher = testnet.SimpleDispatcher()
		persister = config.Persister
		cm = testnet.BrokerConfiguration()
	})

	Describe("brokertest test simpledispatcher", func() {
		BeforeEach(func() {
			testnet.SetupSQL(persister)
		})
		AfterEach(func() {
Beispiel #3
0
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
	"net/http/httptest"
	"net/url"
	"strconv"
	"time"
)

var _ = Describe("Broker", func() {
	var brokerservice *dockerapi.DockerClient
	var serviceagent brokerapi.ServiceAgent
	var ts *httptest.Server
	var handler *testnet.TestHandler
	var persister brokerapi.Persister
	var am *dockerapi.AgentManager
	var dispatcher brokerapi.DispatcherInterface
	var dockerServices []brokerapi.Service
	var opts brokerapi.Options
	var err error
	JustBeforeEach(func() {
		opts = brokerapi.Options{
			Host:     "localhost",
			Port:     61235,
			Username: "******",
			Password: "******",
			Debug:    false,
			LogFile:  "",
			Trace:    false,
			PidFile:  "",
	"github.com/brahmaroutu/docker-broker/broker/dockerapi"
	"github.com/brahmaroutu/docker-broker/broker/testhelpers"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"fmt"
	"net/http"
	"net/http/httptest"
	"time"
)

var _ = Describe("Dockerclient", func() {
	var brokerservice *dockerapi.DockerClient
	var serviceagent brokerapi.ServiceAgent
	var persister brokerapi.Persister
	var cm dockerapi.BrokerConfiguration
	var ts *httptest.Server
	var handler *testnet.TestHandler
	var err error

	Describe("brokertest test dockerclient", func() {
		BeforeEach(func() {
			serviceagent = testnet.NewServiceAgent()
			persister = testnet.NewPersister()
			cm = testnet.BrokerConfiguration()
			testnet.SetupSQL(persister)
		})
		AfterEach(func() {
			testnet.CleanupSQL(persister)
		})
package dockerapi_test

import (
	"github.com/brahmaroutu/docker-broker/broker/brokerapi"
	"github.com/brahmaroutu/docker-broker/broker/dockerapi"
	"github.com/brahmaroutu/docker-broker/broker/testhelpers"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"errors"
	"time"
)

var _ = Describe("Agentmanager", func() {
	var persister brokerapi.Persister
	var am *dockerapi.AgentManager
	var dockerServices []brokerapi.Service
	var cm dockerapi.BrokerConfiguration
	var err error
	JustBeforeEach(func() {
		persister = testnet.NewPersister()
		persister.Connect()
		cm = testnet.BrokerConfiguration()

		dispatcher := testnet.SimpleDispatcher()
		dockerServices = testnet.NewDockerServices()

		am, err = dockerapi.NewAgentManager(testnet.BrokerConfiguration(), dispatcher)
		Expect(err).ShouldNot(HaveOccurred())