// test that an error is returned if malformed JSON is at the url endpoint
handler:=&URLHandlerMalformed{}
server:=httptest.NewServer(handler)
_,err:=getK8sVersionsFromURL(server.URL)
iferr==nil{
t.Fatalf("Malformed version value was returned from URL but no error was thrown")
}
}
funcTestPrintKubernetesVersions(t*testing.T){
// test that no kubernetes version text is printed if there are no versions being served
// TODO(aprindle) or should this be an error?!?!
handlerNone:=&URLHandlerNone{}
server:=httptest.NewServer(handlerNone)
varoutputBufferbytes.Buffer
PrintKubernetesVersions(&outputBuffer,server.URL)
iflen(outputBuffer.String())!=0{
t.Fatalf("Expected PrintKubernetesVersions to not output text as there are no versioned served at the current URL but output was [%s]",outputBuffer.String())
}
// test that update text is printed if the latest version is greater than the current version