MCPcopy Index your code
hub / github.com/koding/kite / TestRegisterToKontrol

Function TestRegisterToKontrol

test/kontrolclient_test.go:51–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestRegisterToKontrol(t *testing.T) {
52 k := setup()
53 defer k.Close()
54
55 kiteURL := &url.URL{Scheme: "http", Host: "zubuzaretta:16500", Path: "/kite"}
56 go k.RegisterForever(kiteURL)
57
58 select {
59 case <-k.KontrolReadyNotify():
60 kites, err := k.GetKites(&protocol.KontrolQuery{
61 Username: k.Kite().Username,
62 Environment: k.Kite().Environment,
63 Name: k.Kite().Name,
64 })
65 if err != nil {
66 t.Fatal(err)
67 }
68
69 first := kites[0]
70 if first.Username != k.Kite().Username {
71 t.Errorf("unexpected kite. got: %s, want: %s", first.Kite, *k.Kite())
72 }
73 if first.URL != "http://zubuzaretta:16500/kite" {
74 t.Errorf("unexpected url: %s", first.URL)
75 }
76 case <-time.After(10 * time.Second):
77 t.Fatal("timeout")
78 }
79}
80
81func setup() *kite.Kite {
82 k := kite.New("test", "1.0.0")

Callers

nothing calls this directly

Calls 7

setupFunction · 0.85
RegisterForeverMethod · 0.80
KontrolReadyNotifyMethod · 0.80
GetKitesMethod · 0.80
FatalMethod · 0.80
CloseMethod · 0.45
KiteMethod · 0.45

Tested by

no test coverage detected