@@ -69,6 +69,77 @@ func TestSelect(t *testing.T) {
6969 },
7070 ))
7171
72+ // Confirm select function preserves immutability
73+ t .Run ("secret-immutable" , run_TestSelect (
74+ map [string ]interface {}{
75+ "apiVersion" : "v1" ,
76+ "kind" : "Secret" ,
77+ "immutable" : true ,
78+ "metadata" : map [string ]interface {}{
79+ "name" : "with-immutable" ,
80+ "namespace" : "example" ,
81+ },
82+ "type" : "Opaque" ,
83+ },
84+ SecretSelectedFields ,
85+ map [string ]interface {}{
86+ "apiVersion" : "v1" ,
87+ "kind" : "Secret" ,
88+ "immutable" : true ,
89+ "metadata" : map [string ]interface {}{
90+ "name" : "with-immutable" ,
91+ "namespace" : "example" ,
92+ },
93+ "type" : "Opaque" ,
94+ },
95+ ))
96+
97+ t .Run ("secret-immutable-false" , run_TestSelect (
98+ map [string ]interface {}{
99+ "apiVersion" : "v1" ,
100+ "kind" : "Secret" ,
101+ "immutable" : false ,
102+ "metadata" : map [string ]interface {}{
103+ "name" : "with-immutable-false" ,
104+ "namespace" : "example" ,
105+ },
106+ "type" : "Opaque" ,
107+ },
108+ SecretSelectedFields ,
109+ map [string ]interface {}{
110+ "apiVersion" : "v1" ,
111+ "kind" : "Secret" ,
112+ "immutable" : false ,
113+ "metadata" : map [string ]interface {}{
114+ "name" : "with-immutable-false" ,
115+ "namespace" : "example" ,
116+ },
117+ "type" : "Opaque" ,
118+ },
119+ ))
120+
121+ t .Run ("secret-immutable-absent" , run_TestSelect (
122+ map [string ]interface {}{
123+ "apiVersion" : "v1" ,
124+ "kind" : "Secret" ,
125+ "metadata" : map [string ]interface {}{
126+ "name" : "immutable-absent" ,
127+ "namespace" : "example" ,
128+ },
129+ "type" : "Opaque" ,
130+ },
131+ SecretSelectedFields ,
132+ map [string ]interface {}{
133+ "apiVersion" : "v1" ,
134+ "kind" : "Secret" ,
135+ "metadata" : map [string ]interface {}{
136+ "name" : "immutable-absent" ,
137+ "namespace" : "example" ,
138+ },
139+ "type" : "Opaque" ,
140+ },
141+ ))
142+
72143 t .Run ("route" , run_TestSelect (
73144 map [string ]interface {}{
74145 "apiVersion" : "v1" ,
0 commit comments