@@ -60,15 +60,7 @@ var statusData = map[schema.GroupVersionResource]string{
|
||||
gvr("internal.apiserver.k8s.io", "v1alpha1", "storageversions"): `{"status": {"commonEncodingVersion":"v1","storageVersions":[{"apiServerID":"1","decodableVersions":["v1","v2"],"encodingVersion":"v1"}],"conditions":[{"type":"AllEncodingVersionsEqual","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"allEncodingVersionsEqual","message":"all encoding versions are set to v1"}]}}`,
|
||||
}
|
||||
|
||||
const statusDefault = `{"status": {"conditions": [{"type": "MyStatus", "status":"true"}]}}`
|
||||
|
||||
// DO NOT ADD TO THIS LIST.
|
||||
// This list is used to ignore known bugs. We shouldn't introduce new bugs.
|
||||
var ignoreList = map[schema.GroupVersionResource]struct{}{
|
||||
// TODO(#89264): apiservices doesn't work because the openapi is not routed properly.
|
||||
gvr("apiregistration.k8s.io", "v1beta1", "apiservices"): {},
|
||||
gvr("apiregistration.k8s.io", "v1", "apiservices"): {},
|
||||
}
|
||||
const statusDefault = `{"status": {"conditions": [{"type": "MyStatus", "status":"True"}]}}`
|
||||
|
||||
// Some status-only APIs have empty object on creation. Therefore we don't expect create_test
|
||||
// managedFields for these APIs
|
||||
@@ -146,9 +138,6 @@ func TestApplyStatus(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Run(mapping.Resource.String(), func(t *testing.T) {
|
||||
if _, ok := ignoreList[mapping.Resource]; ok {
|
||||
t.Skip()
|
||||
}
|
||||
status, ok := statusData[mapping.Resource]
|
||||
if !ok {
|
||||
status = statusDefault
|
||||
@@ -167,8 +156,17 @@ func TestApplyStatus(t *testing.T) {
|
||||
namespace = ""
|
||||
}
|
||||
name := newObj.GetName()
|
||||
|
||||
// etcd test stub data doesn't contain apiVersion/kind (!), but apply requires it
|
||||
newObj.SetGroupVersionKind(mapping.GroupVersionKind)
|
||||
createData, err := json.Marshal(newObj.Object)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
rsc := dynamicClient.Resource(mapping.Resource).Namespace(namespace)
|
||||
_, err := rsc.Create(context.TODO(), &newObj, metav1.CreateOptions{FieldManager: "create_test"})
|
||||
// apply to create
|
||||
_, err = rsc.Patch(context.TODO(), name, types.ApplyPatchType, []byte(createData), metav1.PatchOptions{FieldManager: "create_test"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user