Skip to content

Commit 88fed88

Browse files
committed
address comments from natasha41575
1 parent e582d19 commit 88fed88

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

test/e2e/pvc_persistence_test.go

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2026 The Kubernetes Authors.
1+
// Copyright The Kubernetes Authors.
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -61,18 +61,24 @@ func TestPVCPersistenceAcrossReplicas(t *testing.T) {
6161
nameHash := NameHash(pvcSandboxName)
6262

6363
// Namespace
64-
ns := &corev1.Namespace{}
65-
ns.Name = fmt.Sprintf("pvc-persistence-test-%d", time.Now().UnixNano())
64+
ns := &corev1.Namespace{
65+
ObjectMeta: metav1.ObjectMeta{
66+
Name: fmt.Sprintf("pvc-persistence-test-%d", time.Now().UnixNano()),
67+
},
68+
}
6669
require.NoError(t, tc.CreateWithCleanup(ctx, ns))
6770

6871
// Sandbox with PVC
6972
sandboxObj := pvcSandbox(ns.Name)
7073
require.NoError(t, tc.CreateWithCleanup(ctx, sandboxObj))
7174

7275
pvcName := fmt.Sprintf("%s-%s", workspacesPVCTemplateName, pvcSandboxName)
73-
pvc := &corev1.PersistentVolumeClaim{}
74-
pvc.Name = pvcName
75-
pvc.Namespace = ns.Name
76+
pvc := &corev1.PersistentVolumeClaim{
77+
ObjectMeta: metav1.ObjectMeta{
78+
Name: pvcName,
79+
Namespace: ns.Name,
80+
},
81+
}
7682

7783
// Wait for sandbox to be ready with 1 replica
7884
t.Logf("Waiting for sandbox to become ready (replicas=1)")
@@ -135,9 +141,12 @@ func TestPVCPersistenceAcrossReplicas(t *testing.T) {
135141
t.Logf("Sandbox status shows replicas=0")
136142

137143
// Pod must be gone
138-
pod := &corev1.Pod{}
139-
pod.Name = pvcSandboxName
140-
pod.Namespace = ns.Name
144+
pod := &corev1.Pod{
145+
ObjectMeta: metav1.ObjectMeta{
146+
Name: pvcSandboxName,
147+
Namespace: ns.Name,
148+
},
149+
}
141150
require.NoError(t, tc.WaitForObjectNotFound(ctx, pod))
142151
t.Logf("Pod deleted")
143152

0 commit comments

Comments
 (0)