1- // Copyright 2022 NetApp, Inc. All Rights Reserved.
1+ // Copyright 2025 NetApp, Inc. All Rights Reserved.
22
33package v1
44
77 "reflect"
88 "testing"
99
10+ "github.com/stretchr/testify/assert"
1011 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1112 "k8s.io/apimachinery/pkg/runtime"
1213
@@ -41,8 +42,7 @@ func TestNewTransaction(t *testing.T) {
4142 Kind : "TridentTransaction" ,
4243 },
4344 ObjectMeta : metav1.ObjectMeta {
44- Name : NameFix (volConfig .Name ),
45- Finalizers : GetTridentFinalizers (),
45+ Name : NameFix (volConfig .Name ),
4646 },
4747 Transaction : runtime.RawExtension {
4848 Raw : MustEncode (json .Marshal (txn )),
@@ -53,6 +53,7 @@ func TestNewTransaction(t *testing.T) {
5353 if ! reflect .DeepEqual (volumeTransaction , expected ) {
5454 t .Fatalf ("TridentTransaction does not match expected result, got %v expected %v" , volumeTransaction , expected )
5555 }
56+ assert .Empty (t , volumeTransaction .Finalizers ) // Transactions should never have finalizers.
5657}
5758
5859func TestNewSnapshotTransaction (t * testing.T ) {
@@ -88,8 +89,7 @@ func TestNewSnapshotTransaction(t *testing.T) {
8889 Kind : "TridentTransaction" ,
8990 },
9091 ObjectMeta : metav1.ObjectMeta {
91- Name : NameFix (volConfig .Name ),
92- Finalizers : GetTridentFinalizers (),
92+ Name : NameFix (volConfig .Name ),
9393 },
9494 Transaction : runtime.RawExtension {
9595 Raw : MustEncode (json .Marshal (txn )),
@@ -100,6 +100,7 @@ func TestNewSnapshotTransaction(t *testing.T) {
100100 if ! reflect .DeepEqual (volumeTransaction , expected ) {
101101 t .Fatalf ("TridentTransaction does not match expected result, got %v expected %v" , volumeTransaction , expected )
102102 }
103+ assert .Empty (t , volumeTransaction .Finalizers ) // Transactions should never have finalizers.
103104}
104105
105106func TestTransaction_Persistent (t * testing.T ) {
@@ -123,8 +124,7 @@ func TestTransaction_Persistent(t *testing.T) {
123124 Kind : "TridentTransaction" ,
124125 },
125126 ObjectMeta : metav1.ObjectMeta {
126- Name : NameFix (volConfig .Name ),
127- Finalizers : GetTridentFinalizers (),
127+ Name : NameFix (volConfig .Name ),
128128 },
129129 Transaction : runtime.RawExtension {
130130 Raw : MustEncode (json .Marshal (txn )),
@@ -180,8 +180,7 @@ func TestSnapshotTransaction_Persistent(t *testing.T) {
180180 Kind : "TridentTransaction" ,
181181 },
182182 ObjectMeta : metav1.ObjectMeta {
183- Name : NameFix (volConfig .Name ),
184- Finalizers : GetTridentFinalizers (),
183+ Name : NameFix (volConfig .Name ),
185184 },
186185 Transaction : runtime.RawExtension {
187186 Raw : MustEncode (json .Marshal (txn )),
0 commit comments