Drop null creationTimestamp from test fixtures

Kubernetes-commit: 6bb6c9934294d8265197c9dfc4c9dd3adaca147a
This commit is contained in:
Jordan Liggitt 2025-03-24 09:37:26 -04:00 committed by Kubernetes Publisher
parent 61eae7552c
commit 5be379c517
4 changed files with 4 additions and 6 deletions

View File

@ -74,7 +74,6 @@ but when marshalled to YAML, produces:
metadata: metadata:
name: myHPA name: myHPA
namespace: myNamespace namespace: myNamespace
creationTimestamp: null
spec: spec:
scaleTargetRef: scaleTargetRef:
kind: "" kind: ""

View File

@ -22,6 +22,7 @@ import (
"testing" "testing"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
"k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@ -421,8 +422,6 @@ func TestListWithTypedFixtures(t *testing.T) {
u.SetGroupVersionKind(r.GetObjectKind().GroupVersionKind()) u.SetGroupVersionKind(r.GetObjectKind().GroupVersionKind())
u.SetName(r.GetName()) u.SetName(r.GetName())
u.SetNamespace(r.GetNamespace()) u.SetNamespace(r.GetNamespace())
// Needed see: https://github.com/kubernetes/kubernetes/issues/67610
unstructured.SetNestedField(u.Object, nil, "metadata", "creationTimestamp")
typedScheme := runtime.NewScheme() typedScheme := runtime.NewScheme()
typedScheme.AddKnownTypeWithName(gvk, &mockResource{}) typedScheme.AddKnownTypeWithName(gvk, &mockResource{})

View File

@ -10,8 +10,8 @@ Transfer-Encoding: chunked
e9 e9
{"type":"ADDED","object":{"kind":"ServiceAccount","apiVersion":"v1","metadata":{"name":"foobar","namespace":"default","uid":"a1453396-7a5c-405a-93f9-ff44af8e7689","resourceVersion":"217","creationTimestamp":"2024-09-18T14:06:40Z"}}} {"type":"ADDED","object":{"kind":"ServiceAccount","apiVersion":"v1","metadata":{"name":"foobar","namespace":"default","uid":"a1453396-7a5c-405a-93f9-ff44af8e7689","resourceVersion":"217","creationTimestamp":"2024-09-18T14:06:40Z"}}}
ba a1
{"type":"BOOKMARK","object":{"kind":"ServiceAccount","apiVersion":"v1","metadata":{"resourceVersion":"964","creationTimestamp":null,"annotations":{"k8s.io/initial-events-end":"true"}}}} {"type":"BOOKMARK","object":{"kind":"ServiceAccount","apiVersion":"v1","metadata":{"resourceVersion":"964","annotations":{"k8s.io/initial-events-end":"true"}}}}
0 0

View File

@ -1 +1 @@
[{"object":{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"creationTimestamp":"2024-09-18T14:06:40Z","name":"foobar","namespace":"default","resourceVersion":"217","uid":"a1453396-7a5c-405a-93f9-ff44af8e7689"}},"type":"ADDED"},{"object":{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{"k8s.io/initial-events-end":"true"},"creationTimestamp":null,"resourceVersion":"964"}},"type":"BOOKMARK"}] [{"object":{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"creationTimestamp":"2024-09-18T14:06:40Z","name":"foobar","namespace":"default","resourceVersion":"217","uid":"a1453396-7a5c-405a-93f9-ff44af8e7689"}},"type":"ADDED"},{"object":{"apiVersion":"v1","kind":"ServiceAccount","metadata":{"annotations":{"k8s.io/initial-events-end":"true"},"resourceVersion":"964"}},"type":"BOOKMARK"}]