Beispiel #1
0
func main() {
	serverRunOptions := apiserver.NewServerRunOptions()

	// Parse command line flags.
	serverRunOptions.AddFlags(pflag.CommandLine)
	flag.InitFlags()

	if err := apiserver.Run(serverRunOptions); err != nil {
		glog.Fatalf("Error in bringing up the server: %v", err)
	}
}
func main() {
	serverRunOptions := apiserver.NewServerRunOptions()

	// Parse command line flags.
	serverRunOptions.AddUniversalFlags(pflag.CommandLine)
	serverRunOptions.AddEtcdStorageFlags(pflag.CommandLine)
	flag.InitFlags()

	if err := apiserver.Run(serverRunOptions, wait.NeverStop); err != nil {
		glog.Fatalf("Error in bringing up the server: %v", err)
	}
}
func TestRun(t *testing.T) {
	go func() {
		if err := apiserver.Run(apiserver.NewServerRunOptions()); err != nil {
			t.Fatalf("Error in bringing up the server: %v", err)
		}
	}()
	if err := waitForApiserverUp(); err != nil {
		t.Fatalf("%v", err)
	}
	testSwaggerSpec(t)
	testAPIGroupList(t)
	testAPIGroup(t)
	testAPIResourceList(t)
}
func runAPIServer(t *testing.T) string {
	serverRunOptions := apiserver.NewServerRunOptions()
	// Change the port, because otherwise it will fail if examples/apiserver/apiserver_test and this are run in parallel.
	serverRunOptions.InsecurePort = 8083
	go func() {
		if err := apiserver.Run(serverRunOptions); err != nil {
			t.Fatalf("Error in bringing up the example apiserver: %v", err)
		}
	}()

	serverURL := fmt.Sprintf("http://localhost:%d", serverRunOptions.InsecurePort)
	if err := waitForServerUp(serverURL); err != nil {
		t.Fatalf("%v", err)
	}
	return serverURL
}
func TestRunServer(t *testing.T) {
	serverIP := fmt.Sprintf("http://localhost:%d", apiserver.InsecurePort)
	stopCh := make(chan struct{})
	go func() {
		if err := apiserver.Run(apiserver.NewServerRunOptions(), stopCh); err != nil {
			t.Fatalf("Error in bringing up the server: %v", err)
		}
	}()
	defer close(stopCh)
	if err := waitForApiserverUp(serverIP); err != nil {
		t.Fatalf("%v", err)
	}
	testSwaggerSpec(t, serverIP)
	testAPIGroupList(t, serverIP)
	testAPIGroup(t, serverIP)
	testAPIResourceList(t, serverIP)
}
Beispiel #6
0
func main() {
	if err := apiserver.Run(); err != nil {
		glog.Fatalf("Error in bringing up the server: %v", err)
	}
}