Fix third party APIResource reporting

This commit is contained in:
Brendan Burns
2016-07-27 23:18:04 -07:00
parent b5ce23c48d
commit b3658c7b16
5 changed files with 212 additions and 56 deletions

View File

@@ -508,7 +508,7 @@ func TestDiscoveryAtAPIS(t *testing.T) {
}
thirdPartyGV := unversioned.GroupVersionForDiscovery{GroupVersion: "company.com/v1", Version: "v1"}
master.addThirdPartyResourceStorage("/apis/company.com/v1", nil,
master.addThirdPartyResourceStorage("/apis/company.com/v1", "foos", nil,
unversioned.APIGroup{
Name: "company.com",
Versions: []unversioned.GroupVersionForDiscovery{thirdPartyGV},
@@ -575,10 +575,18 @@ func initThirdPartyMultiple(t *testing.T, versions, names []string) (*Master, *e
},
},
}
err := master.InstallThirdPartyResource(api)
if !assert.NoError(err) {
t.Logf("Failed to install API: %v", err)
t.FailNow()
hasRsrc, err := master.HasThirdPartyResource(api)
if err != nil {
t.Errorf("Unexpected error: %v", err)
}
if !hasRsrc {
err := master.InstallThirdPartyResource(api)
if !assert.NoError(err) {
t.Errorf("Failed to install API: %v", err)
t.FailNow()
}
} else {
t.Errorf("Expected %s: %v not to be present!", names[ix], api)
}
}
@@ -1078,7 +1086,7 @@ func testInstallThirdPartyResourceRemove(t *testing.T, version string) {
}
path := makeThirdPartyPath("company.com")
master.RemoveThirdPartyResource(path)
master.RemoveThirdPartyResource(path + "/foos")
resp, err = http.Get(server.URL + "/apis/company.com/" + version + "/namespaces/default/foos/test")
if !assert.NoError(err) {