Esempio n. 1
0
	"testing"

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

	"github.com/cloudwan/gohan/db"
	"github.com/cloudwan/gohan/db/transaction"
	"github.com/cloudwan/gohan/schema"
	srv "github.com/cloudwan/gohan/server"
	"github.com/cloudwan/gohan/sync/etcd"
)

var (
	server           *srv.Server
	baseURL          = "http://localhost:19090"
	networkPluralURL = baseURL + "/v2.0/networks"
	subnetPluralURL  = baseURL + "/v2.0/subnets"
	testPluralURL    = baseURL + "/v2.0/tests"
)

var _ = Describe("Server package test", func() {

	AfterEach(func() {
		tx, err := testDB.Begin()
		Expect(err).ToNot(HaveOccurred(), "Failed to create transaction.")
		defer tx.Close()
		for _, schema := range schema.GetManager().Schemas() {
			if whitelist[schema.ID] {
				continue
			}
			err = clearTable(tx, schema)
Esempio n. 2
0
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"github.com/cloudwan/gohan/db"
	"github.com/cloudwan/gohan/db/transaction"
	"github.com/cloudwan/gohan/schema"
	srv "github.com/cloudwan/gohan/server"
	gohan_sync "github.com/cloudwan/gohan/sync"
	gohan_etcd "github.com/cloudwan/gohan/sync/etcd"
	"github.com/cloudwan/gohan/util"
)

var (
	server           *srv.Server
	baseURL          = "http://localhost:19090"
	schemaURL        = baseURL + "/gohan/v0.1/schemas"
	networkPluralURL = baseURL + "/v2.0/networks"
	subnetPluralURL  = baseURL + "/v2.0/subnets"
	testPluralURL    = baseURL + "/v2.0/tests"
)

var _ = Describe("Server package test", func() {

	AfterEach(func() {
		tx, err := testDB.Begin()
		Expect(err).ToNot(HaveOccurred(), "Failed to create transaction.")
		defer tx.Close()
		for _, schema := range schema.GetManager().Schemas() {
			if whitelist[schema.ID] {
				continue
			}
			err = clearTable(tx, schema)