@@ -12,7 +12,6 @@ import (
12
12
"google.golang.org/protobuf/types/known/structpb"
13
13
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
14
14
"k8s.io/apimachinery/pkg/runtime"
15
- "k8s.io/apimachinery/pkg/runtime/schema"
16
15
"k8s.io/utils/ptr"
17
16
18
17
"github.com/crossplane/crossplane-runtime/pkg/logging"
@@ -95,7 +94,7 @@ func TestRunFunction(t *testing.T) {
95
94
},
96
95
},
97
96
},
98
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
97
+ Context : contextWithEnvironment (nil ),
99
98
},
100
99
},
101
100
},
@@ -126,7 +125,7 @@ func TestRunFunction(t *testing.T) {
126
125
},
127
126
},
128
127
},
129
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
128
+ Context : contextWithEnvironment (nil ),
130
129
},
131
130
},
132
131
want : want {
@@ -145,7 +144,7 @@ func TestRunFunction(t *testing.T) {
145
144
},
146
145
},
147
146
},
148
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
147
+ Context : contextWithEnvironment (nil ),
149
148
},
150
149
},
151
150
},
@@ -210,7 +209,7 @@ func TestRunFunction(t *testing.T) {
210
209
},
211
210
},
212
211
},
213
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
212
+ Context : contextWithEnvironment (nil ),
214
213
},
215
214
},
216
215
},
@@ -282,7 +281,7 @@ func TestRunFunction(t *testing.T) {
282
281
},
283
282
},
284
283
},
285
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
284
+ Context : contextWithEnvironment (nil ),
286
285
},
287
286
},
288
287
},
@@ -380,7 +379,7 @@ func TestRunFunction(t *testing.T) {
380
379
},
381
380
},
382
381
},
383
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
382
+ Context : contextWithEnvironment (nil ),
384
383
},
385
384
},
386
385
},
@@ -436,7 +435,7 @@ func TestRunFunction(t *testing.T) {
436
435
},
437
436
},
438
437
},
439
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
438
+ Context : contextWithEnvironment (nil ),
440
439
},
441
440
},
442
441
},
@@ -537,7 +536,7 @@ func TestRunFunction(t *testing.T) {
537
536
// Note "new-resource" doesn't appear here.
538
537
},
539
538
},
540
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
539
+ Context : contextWithEnvironment (nil ),
541
540
Results : []* fnv1beta1.Result {
542
541
{
543
542
Severity : fnv1beta1 .Severity_SEVERITY_WARNING ,
@@ -652,7 +651,7 @@ func TestRunFunction(t *testing.T) {
652
651
},
653
652
},
654
653
},
655
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
654
+ Context : contextWithEnvironment (nil ),
656
655
},
657
656
},
658
657
},
@@ -715,7 +714,7 @@ func TestRunFunction(t *testing.T) {
715
714
},
716
715
},
717
716
},
718
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
717
+ Context : contextWithEnvironment (nil ),
719
718
},
720
719
},
721
720
},
@@ -785,7 +784,7 @@ func TestRunFunction(t *testing.T) {
785
784
},
786
785
},
787
786
},
788
- Context : & structpb. Struct { Fields : map [ string ] * structpb. Value { fncontext . KeyEnvironment : structpb . NewStructValue (nil )}} ,
787
+ Context : contextWithEnvironment (nil ),
789
788
},
790
789
},
791
790
},
@@ -1227,7 +1226,7 @@ func contextWithEnvironment(data map[string]interface{}) *structpb.Struct {
1227
1226
data = map [string ]interface {}{}
1228
1227
}
1229
1228
u := unstructured.Unstructured {Object : data }
1230
- u .SetGroupVersionKind (schema. GroupVersionKind { Group : "internal.crossplane.io" , Version : "v1alpha1" , Kind : "Environment" } )
1229
+ u .SetGroupVersionKind (internalEnvironmentGVK )
1231
1230
d , err := structpb .NewStruct (u .UnstructuredContent ())
1232
1231
if err != nil {
1233
1232
panic (err )
0 commit comments