@@ -18,7 +18,6 @@ package controller
1818
1919import (
2020 "context"
21- "fmt"
2221 "testing"
2322
2423 replicationv1alpha1 "github.com/csi-addons/kubernetes-csi-addons/api/replication.storage/v1alpha1"
@@ -181,7 +180,6 @@ func TestGetVolumeHandle(t *testing.T) {
181180func TestVolumeReplicationReconciler_annotatePVCWithOwner (t * testing.T ) {
182181 t .Parallel ()
183182 vrName := "test-vr"
184- vrNamespace := "test-ns"
185183
186184 testcases := []struct {
187185 name string
@@ -200,7 +198,7 @@ func TestVolumeReplicationReconciler_annotatePVCWithOwner(t *testing.T) {
200198 Name : "pvc-name" ,
201199 Namespace : mockNamespace ,
202200 Annotations : map [string ]string {
203- replicationv1alpha1 .VolumeReplicationNameAnnotation : fmt . Sprintf ( "%s/%s" , vrNamespace , vrName ) ,
201+ replicationv1alpha1 .VolumeReplicationNameAnnotation : vrName ,
204202 },
205203 },
206204 },
@@ -232,8 +230,7 @@ func TestVolumeReplicationReconciler_annotatePVCWithOwner(t *testing.T) {
232230 ctx := context .TODO ()
233231 logger := log .FromContext (ctx )
234232 reconciler := createFakeVolumeReplicationReconciler (t , testPVC , volumeReplication )
235- reqOwner := fmt .Sprintf ("%s/%s" , volumeReplication .Namespace , volumeReplication .Name )
236- err := annotatePVCWithOwner (reconciler .Client , ctx , logger , reqOwner , testPVC , replicationv1alpha1 .VolumeReplicationNameAnnotation )
233+ err := annotatePVCWithOwner (reconciler .Client , ctx , logger , volumeReplication .Name , testPVC , replicationv1alpha1 .VolumeReplicationNameAnnotation )
237234 if tc .errorExpected {
238235 assert .Error (t , err )
239236 } else {
@@ -248,7 +245,7 @@ func TestVolumeReplicationReconciler_annotatePVCWithOwner(t *testing.T) {
248245 err = reconciler .Get (ctx , pvcNamespacedName , testPVC )
249246 assert .NoError (t , err )
250247
251- assert .Equal (t , testPVC .Annotations [replicationv1alpha1 .VolumeReplicationNameAnnotation ], reqOwner )
248+ assert .Equal (t , testPVC .Annotations [replicationv1alpha1 .VolumeReplicationNameAnnotation ], volumeReplication . Name )
252249 }
253250
254251 err = removeOwnerFromPVCAnnotation (reconciler .Client , ctx , log .FromContext (context .TODO ()), testPVC , replicationv1alpha1 .VolumeReplicationNameAnnotation )
0 commit comments