File tree Expand file tree Collapse file tree 1 file changed +89
-0
lines changed Expand file tree Collapse file tree 1 file changed +89
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright 2019 The Kubernetes Authors.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ package merge_test
18
+
19
+ import (
20
+ "testing"
21
+
22
+ "sigs.k8s.io/structured-merge-diff/fieldpath"
23
+ . "sigs.k8s.io/structured-merge-diff/internal/fixture"
24
+ )
25
+
26
+ func TestMultipleAppliersSetBroken (t * testing.T ) {
27
+ tests := map [string ]TestCase {
28
+ "remove_one_keep_one" : {
29
+ Ops : []Operation {
30
+ Apply {
31
+ Manager : "apply-one" ,
32
+ APIVersion : "v1" ,
33
+ Object : `
34
+ list:
35
+ - a
36
+ - b
37
+ - c
38
+ ` ,
39
+ },
40
+ Apply {
41
+ Manager : "apply-two" ,
42
+ APIVersion : "v2" ,
43
+ Object : `
44
+ list:
45
+ - c
46
+ - d
47
+ ` ,
48
+ },
49
+ Apply {
50
+ Manager : "apply-one" ,
51
+ APIVersion : "v3" ,
52
+ Object : `
53
+ list:
54
+ - a
55
+ ` ,
56
+ },
57
+ },
58
+ Object : `
59
+ list:
60
+ - a
61
+ - c
62
+ - d
63
+ ` ,
64
+ Managed : fieldpath.ManagedFields {
65
+ "apply-one" : & fieldpath.VersionedSet {
66
+ Set : _NS (
67
+ _P ("list" , _SV ("a" )),
68
+ ),
69
+ APIVersion : "v3" ,
70
+ },
71
+ "apply-two" : & fieldpath.VersionedSet {
72
+ Set : _NS (
73
+ _P ("list" , _SV ("c" )),
74
+ _P ("list" , _SV ("d" )),
75
+ ),
76
+ APIVersion : "v2" ,
77
+ },
78
+ },
79
+ },
80
+ }
81
+
82
+ for name , test := range tests {
83
+ t .Run (name , func (t * testing.T ) {
84
+ if test .Test (setFieldsParser ) == nil {
85
+ t .Fatal ("Broken test passed" )
86
+ }
87
+ })
88
+ }
89
+ }
You can’t perform that action at this time.
0 commit comments