hyperkube: add alpha subcommand

This commit is contained in:
Cole Mickens
2017-10-27 10:55:40 -07:00
parent 1675f025ea
commit f1c12f8b13
3 changed files with 57 additions and 3 deletions

View File

@@ -151,6 +151,7 @@ func runFull(t *testing.T, args string, stopCh <-chan struct{}) *result {
hk.AddServer(testServer("test1"))
hk.AddServer(testServer("test2"))
hk.AddServer(testServer("test3"))
hk.AddAlphaServer(testServer("testAlpha1"))
hk.AddServer(testServerError("test-error"))
hk.AddServer(testStopChIgnoringServer("test-stop-ch-ignoring"))
hk.AddServer(testStopChRespectingServer("test-stop-ch-respecting"))
@@ -236,6 +237,22 @@ func TestServerError(t *testing.T) {
assert.EqualError(t, x.err, "server returning error")
}
func TestAlphaRun(t *testing.T) {
x := runFull(t, "hyperkube alpha testAlpha1", wait.NeverStop)
assert.NoError(t, x.err)
}
func TestAlphaNoArgs(t *testing.T) {
x := runFull(t, "hyperkube alpha", wait.NeverStop)
assert.EqualError(t, x.err, "no alpha server specified")
}
func TestAlphaBadServer(t *testing.T) {
x := runFull(t, "hyperkube alpha bad-server", wait.NeverStop)
assert.EqualError(t, x.err, "Server not found: bad-server")
assert.Contains(t, x.output, "Usage")
}
func TestStopChIgnoringServer(t *testing.T) {
stopCh := make(chan struct{})
returnedCh := make(chan struct{})