示例#1
0
func main() {
	// TODO: move them to flags.
	configFilePath := "config.json"
	port := "9090"
	s, err := discoverysummarizer.NewDiscoverySummarizer(configFilePath)
	if err != nil {
		glog.Fatalf("%v\n", err)
	}
	err = s.Run(port)
	if err != nil {
		glog.Fatalf("%v\n", err)
	}
}
func runDiscoverySummarizer(t *testing.T) string {
	configFilePath := "../../../cmd/kubernetes-discovery/config.json"
	port := "9090"
	serverURL := "http://localhost:" + port
	s, err := discoverysummarizer.NewDiscoverySummarizer(configFilePath)
	if err != nil {
		t.Errorf("unexpected error: %v\n", err)
	}
	go func() {
		if err := s.Run(port); err != nil {
			t.Fatalf("error in bringing up the server: %v", err)
		}
	}()
	if err := waitForServerUp(serverURL); err != nil {
		t.Fatalf("%v", err)
	}
	return serverURL
}