Skip to content

Commit 29cf649

Browse files
committed
codegen
On-behalf-of: @SAP [email protected]
1 parent 3e8fa72 commit 29cf649

5 files changed

+33
-21
lines changed

internal/sync/crd/dummy.example.com_namespacedthings.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ spec:
4040
properties:
4141
address:
4242
type: string
43+
kink:
44+
type: string
4345
username:
4446
type: string
4547
required:
48+
- kink
4649
- username
4750
type: object
4851
required:

internal/sync/crd/dummy.example.com_things.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ spec:
4040
properties:
4141
address:
4242
type: string
43+
kink:
44+
type: string
4345
username:
4446
type: string
4547
required:
48+
- kink
4649
- username
4750
type: object
4851
required:

internal/sync/crd/dummy.example.com_thingwithstatuses.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ spec:
4040
properties:
4141
address:
4242
type: string
43+
kink:
44+
type: string
4345
username:
4446
type: string
4547
required:
48+
- kink
4649
- username
4750
type: object
4851
status:

internal/sync/crd/dummy.example.com_thingwithstatussubresources.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ spec:
4040
properties:
4141
address:
4242
type: string
43+
kink:
44+
type: string
4345
username:
4446
type: string
4547
required:
48+
- kink
4649
- username
4750
type: object
4851
status:

internal/sync/syncer_test.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
193193
Username: "Colonel Mustard",
194194
},
195195
}),
196-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
196+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
197197

198198
expectedRemoteObject: newUnstructured(&dummyv1alpha1.Thing{
199199
ObjectMeta: metav1.ObjectMeta{
@@ -222,7 +222,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
222222
Username: "Colonel Mustard",
223223
},
224224
}),
225-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
225+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
226226
},
227227

228228
/////////////////////////////////////////////////////////////////////////////////
@@ -271,7 +271,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
271271
Username: "Colonel Mustard",
272272
},
273273
}),
274-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
274+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
275275
},
276276

277277
/////////////////////////////////////////////////////////////////////////////////
@@ -330,7 +330,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
330330
Username: "Colonel Mustard",
331331
},
332332
}),
333-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
333+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
334334
},
335335

336336
/////////////////////////////////////////////////////////////////////////////////
@@ -368,7 +368,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
368368
Username: "Colonel Mustard",
369369
},
370370
}),
371-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
371+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
372372

373373
expectedRemoteObject: newUnstructured(&dummyv1alpha1.Thing{
374374
ObjectMeta: metav1.ObjectMeta{
@@ -397,7 +397,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
397397
Username: "Miss Scarlet",
398398
},
399399
}),
400-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Miss Scarlet"}}`,
400+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Miss Scarlet"}}`,
401401
},
402402

403403
/////////////////////////////////////////////////////////////////////////////////
@@ -464,7 +464,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
464464
Username: "Colonel Mustard",
465465
},
466466
}),
467-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
467+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
468468
},
469469

470470
/////////////////////////////////////////////////////////////////////////////////
@@ -513,7 +513,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
513513
Username: "Colonel Mustard",
514514
},
515515
}),
516-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"annotations":{"existing-annotation":"annotation-value"},"labels":{"existing-label":"label-value"},"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
516+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"annotations":{"existing-annotation":"annotation-value"},"labels":{"existing-label":"label-value"},"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
517517

518518
expectedRemoteObject: newUnstructured(&dummyv1alpha1.Thing{
519519
ObjectMeta: metav1.ObjectMeta{
@@ -557,7 +557,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
557557
},
558558
}),
559559
// last state annotation is "space optimized" and so does not include the ignored labels and annotations
560-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"annotations":{"existing-annotation":"new-annotation-value","new-annotation":"hei-verden"},"labels":{"existing-label":"new-label-value","new-label":"hello-world"},"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
560+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"annotations":{"existing-annotation":"new-annotation-value","new-annotation":"hei-verden"},"labels":{"existing-label":"new-label-value","new-label":"hello-world"},"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
561561
},
562562

563563
/////////////////////////////////////////////////////////////////////////////////
@@ -592,7 +592,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
592592
Username: "Colonel Mustard",
593593
},
594594
}),
595-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
595+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
596596

597597
expectedRemoteObject: newUnstructured(&dummyv1alpha1.Thing{
598598
ObjectMeta: metav1.ObjectMeta{
@@ -622,7 +622,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
622622
},
623623
}),
624624
// last state annotation is "space optimized" and so does not include the ignored labels and annotations
625-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
625+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
626626
},
627627

628628
/////////////////////////////////////////////////////////////////////////////////
@@ -661,7 +661,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
661661
Address: "Hotdogstr. 13", // we assume this field was set by a local controller/webhook, unrelated to the Sync Agent
662662
},
663663
}),
664-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
664+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
665665

666666
expectedRemoteObject: newUnstructured(&dummyv1alpha1.Thing{
667667
ObjectMeta: metav1.ObjectMeta{
@@ -692,7 +692,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
692692
Address: "Hotdogstr. 13",
693693
},
694694
}),
695-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Miss Scarlet"}}`,
695+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Miss Scarlet"}}`,
696696
},
697697

698698
/////////////////////////////////////////////////////////////////////////////////
@@ -737,7 +737,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
737737
Username: "Colonel Mustard",
738738
},
739739
}),
740-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
740+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
741741

742742
expectedRemoteObject: newUnstructured(&dummyv1alpha1.Thing{
743743
ObjectMeta: metav1.ObjectMeta{
@@ -771,7 +771,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
771771
Username: "Colonel Mustard",
772772
},
773773
}),
774-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
774+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
775775
},
776776

777777
/////////////////////////////////////////////////////////////////////////////////
@@ -850,7 +850,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
850850
Username: "Colonel Mustard",
851851
},
852852
}),
853-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
853+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
854854

855855
expectedRemoteObject: newUnstructured(&dummyv1alpha1.Thing{
856856
ObjectMeta: metav1.ObjectMeta{
@@ -881,7 +881,7 @@ func TestSyncerProcessingSingleResourceWithoutStatus(t *testing.T) {
881881
Username: "Colonel Mustard",
882882
},
883883
}),
884-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
884+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
885885
},
886886
}
887887

@@ -1076,7 +1076,7 @@ func TestSyncerProcessingSingleResourceWithStatus(t *testing.T) {
10761076
CurrentVersion: "v1",
10771077
},
10781078
}),
1079-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
1079+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
10801080

10811081
expectedRemoteObject: newUnstructured(&dummyv1alpha1.ThingWithStatusSubresource{
10821082
ObjectMeta: metav1.ObjectMeta{
@@ -1111,7 +1111,7 @@ func TestSyncerProcessingSingleResourceWithStatus(t *testing.T) {
11111111
CurrentVersion: "v1",
11121112
},
11131113
}),
1114-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
1114+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
11151115
},
11161116

11171117
/////////////////////////////////////////////////////////////////////////////////
@@ -1152,7 +1152,7 @@ func TestSyncerProcessingSingleResourceWithStatus(t *testing.T) {
11521152
CurrentVersion: "v1",
11531153
},
11541154
}),
1155-
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
1155+
existingState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
11561156

11571157
expectedRemoteObject: newUnstructured(&dummyv1alpha1.ThingWithStatusSubresource{
11581158
ObjectMeta: metav1.ObjectMeta{
@@ -1187,7 +1187,7 @@ func TestSyncerProcessingSingleResourceWithStatus(t *testing.T) {
11871187
CurrentVersion: "v1",
11881188
},
11891189
}),
1190-
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"username":"Colonel Mustard"}}`,
1190+
expectedState: `{"apiVersion":"remote.example.corp/v1alpha1","kind":"RemoteThing","metadata":{"name":"my-test-thing"},"spec":{"kink":"","username":"Colonel Mustard"}}`,
11911191
},
11921192
}
11931193

0 commit comments

Comments
 (0)