Update storage hash to use ingress type for cross-group comparison

This commit is contained in:
Jordan Liggitt 2019-12-10 11:56:34 -05:00
parent 2b4fac5760
commit e9870c3076

View File

@ -426,32 +426,32 @@ func TestStorageVersionHashEqualities(t *testing.T) {
server := httptest.NewServer(master.GenericAPIServer.Handler.GoRestfulContainer.ServeMux) server := httptest.NewServer(master.GenericAPIServer.Handler.GoRestfulContainer.ServeMux)
// Test 1: extensions/v1beta1/replicasets and apps/v1/replicasets have // Test 1: extensions/v1beta1/ingresses and apps/v1/ingresses have
// the same storage version hash. // the same storage version hash.
resp, err := http.Get(server.URL + "/apis/extensions/v1beta1") resp, err := http.Get(server.URL + "/apis/extensions/v1beta1")
assert.Empty(err) assert.Empty(err)
extList := metav1.APIResourceList{} extList := metav1.APIResourceList{}
assert.NoError(decodeResponse(resp, &extList)) assert.NoError(decodeResponse(resp, &extList))
var extReplicasetHash, appsReplicasetHash string var extIngressHash, appsIngressHash string
for _, r := range extList.APIResources { for _, r := range extList.APIResources {
if r.Name == "replicasets" { if r.Name == "ingresses" {
extReplicasetHash = r.StorageVersionHash extIngressHash = r.StorageVersionHash
assert.NotEmpty(extReplicasetHash) assert.NotEmpty(extIngressHash)
} }
} }
resp, err = http.Get(server.URL + "/apis/apps/v1") resp, err = http.Get(server.URL + "/apis/networking.k8s.io/v1beta1")
assert.Empty(err) assert.Empty(err)
appsList := metav1.APIResourceList{} appsList := metav1.APIResourceList{}
assert.NoError(decodeResponse(resp, &appsList)) assert.NoError(decodeResponse(resp, &appsList))
for _, r := range appsList.APIResources { for _, r := range appsList.APIResources {
if r.Name == "replicasets" { if r.Name == "ingresses" {
appsReplicasetHash = r.StorageVersionHash appsIngressHash = r.StorageVersionHash
assert.NotEmpty(appsReplicasetHash) assert.NotEmpty(appsIngressHash)
} }
} }
if len(extReplicasetHash) > 0 && len(appsReplicasetHash) > 0 { if len(extIngressHash) > 0 && len(appsIngressHash) > 0 {
assert.Equal(extReplicasetHash, appsReplicasetHash) assert.Equal(extIngressHash, appsIngressHash)
} }
// Test 2: batch/v1/jobs and batch/v1beta1/cronjobs have different // Test 2: batch/v1/jobs and batch/v1beta1/cronjobs have different