Exemple #1
0
func TestController(t *testing.T) {
	setkeys := []string{
		"/deis/registry/protocol",
		"deis/registry/host",
		"/deis/registry/port",
		"/deis/cache/host",
		"/deis/cache/port",
	}
	setdir := []string{
		"/deis/controller",
		"/deis/cache",
		"/deis/database",
		"/deis/registry",
		"/deis/domains",
	}
	testID := utils.NewID()
	err := dockercli.BuildImage(t, "../", "deis/controller:"+testID)
	if err != nil {
		t.Fatal(err)
	}
	etcdPort := utils.GetRandomPort()
	dockercli.RunEtcdTest(t, testID, etcdPort)
	handler := etcdutils.InitetcdValues(setdir, setkeys, etcdPort)
	etcdutils.Publishvalues(t, handler)
	dbPort := utils.GetRandomPort()
	mock.RunMockDatabase(t, testID, etcdPort, dbPort)
	servicePort := utils.GetRandomPort()
	fmt.Printf("--- Test deis-controller-%s at port %s\n", testID, servicePort)
	runDeisControllerTest(t, testID, etcdPort, servicePort)
	dockercli.DeisServiceTest(
		t, "deis-controller-"+testID, servicePort, "http")
	dockercli.ClearTestSession(t, testID)
}
Exemple #2
0
func TestRouter(t *testing.T) {
	setkeys := []string{
		"deis/controller/host",
		"/deis/controller/port",
		"/deis/builder/host",
		"/deis/builder/port",
	}
	setdir := []string{
		"/deis/controller",
		"/deis/router",
		"/deis/database",
		"/deis/services",
		"/deis/builder",
		"/deis/domains",
	}
	testID := utils.NewID()
	err := dockercli.BuildImage(t, "../", "deis/router:"+testID)
	if err != nil {
		t.Fatal(err)
	}
	etcdPort := utils.GetRandomPort()
	dockercli.RunEtcdTest(t, testID, etcdPort)
	handler := etcdutils.InitetcdValues(setdir, setkeys, etcdPort)
	etcdutils.Publishvalues(t, handler)
	servicePort := utils.GetRandomPort()
	fmt.Printf("--- Test deis-router-%s at port %s\n", testID, servicePort)
	runDeisRouterTest(t, testID, etcdPort, servicePort)
	// TODO: nginx needs a few seconds to wake up here--fixme!
	time.Sleep(5000 * time.Millisecond)
	dockercli.DeisServiceTest(
		t, "deis-router-"+testID, servicePort, "http")
	dockercli.ClearTestSession(t, testID)
}
Exemple #3
0
func TestCache(t *testing.T) {
	testID := utils.NewID()
	err := dockercli.BuildImage(t, "../", "deis/cache:"+testID)
	if err != nil {
		t.Fatal(err)
	}
	etcdPort := utils.GetRandomPort()
	dockercli.RunEtcdTest(t, testID, etcdPort)
	servicePort := utils.GetRandomPort()
	fmt.Printf("--- Test deis-cache-%s at port %s\n", testID, servicePort)
	runDeisCacheTest(t, testID, etcdPort, servicePort)
	dockercli.DeisServiceTest(
		t, "deis-cache-"+testID, servicePort, "tcp")
	dockercli.ClearTestSession(t, testID)
}
Exemple #4
0
func TestRegistry(t *testing.T) {
	setkeys := []string{
		"/deis/cache/host",
		"/deis/cache/port",
	}
	setdir := []string{
		"/deis/cache",
	}
	testID := utils.NewID()
	err := dockercli.BuildImage(t, "../", "deis/registry:"+testID)
	if err != nil {
		t.Fatal(err)
	}
	etcdPort := utils.GetRandomPort()
	dockercli.RunEtcdTest(t, testID, etcdPort)
	handler := etcdutils.InitetcdValues(setdir, setkeys, etcdPort)
	etcdutils.Publishvalues(t, handler)
	servicePort := utils.GetRandomPort()
	fmt.Printf("--- Test deis-registry-%s at port %s\n", testID, servicePort)
	runDeisRegistryTest(t, testID, etcdPort, servicePort)
	dockercli.DeisServiceTest(
		t, "deis-registry-"+testID, servicePort, "http")
	dockercli.ClearTestSession(t, testID)
}