@@ -28,6 +28,7 @@ func TestGenericTypeMeta(t *testing.T) {
28
28
type TypeMeta struct {
29
29
Kind string `json:"kind,omitempty"`
30
30
Namespace string `json:"namespace,omitempty"`
31
+ Tenant string `json:"tenant,omitempty"`
31
32
Name string `json:"name,omitempty"`
32
33
GenerateName string `json:"generateName,omitempty"`
33
34
UID string `json:"uid,omitempty"`
@@ -44,6 +45,7 @@ func TestGenericTypeMeta(t *testing.T) {
44
45
j := Object {
45
46
TypeMeta {
46
47
Namespace : "bar" ,
48
+ Tenant : "hah" ,
47
49
Name : "foo" ,
48
50
GenerateName : "prefix" ,
49
51
UID : "uid" ,
@@ -62,6 +64,9 @@ func TestGenericTypeMeta(t *testing.T) {
62
64
if e , a := "bar" , accessor .Namespace (); e != a {
63
65
t .Errorf ("expected %v, got %v" , e , a )
64
66
}
67
+ if e , a := "hah" , accessor .Tenant (); e != a {
68
+ t .Errorf ("expected %v, got %v" , e , a )
69
+ }
65
70
if e , a := "foo" , accessor .Name (); e != a {
66
71
t .Errorf ("expected %v, got %v" , e , a )
67
72
}
@@ -96,6 +101,7 @@ func TestGenericTypeMeta(t *testing.T) {
96
101
}
97
102
98
103
accessor .SetNamespace ("baz" )
104
+ accessor .SetTenant ("uau" )
99
105
accessor .SetName ("bar" )
100
106
accessor .SetGenerateName ("generate" )
101
107
accessor .SetUID ("other" )
@@ -108,6 +114,9 @@ func TestGenericTypeMeta(t *testing.T) {
108
114
if e , a := "baz" , j .Namespace ; e != a {
109
115
t .Errorf ("expected %v, got %v" , e , a )
110
116
}
117
+ if e , a := "uau" , j .Tenant ; e != a {
118
+ t .Errorf ("expected %v, got %v" , e , a )
119
+ }
111
120
if e , a := "bar" , j .Name ; e != a {
112
121
t .Errorf ("expected %v, got %v" , e , a )
113
122
}
@@ -143,6 +152,7 @@ func TestGenericTypeMeta(t *testing.T) {
143
152
type InternalTypeMeta struct {
144
153
Kind string `json:"kind,omitempty"`
145
154
Namespace string `json:"namespace,omitempty"`
155
+ Tenant string `json:"tenant,omitempty"`
146
156
Name string `json:"name,omitempty"`
147
157
GenerateName string `json:"generateName,omitempty"`
148
158
UID string `json:"uid,omitempty"`
@@ -163,6 +173,7 @@ func TestGenericTypeMetaAccessor(t *testing.T) {
163
173
j := & InternalObject {
164
174
InternalTypeMeta {
165
175
Namespace : "bar" ,
176
+ Tenant : "hah" ,
166
177
Name : "foo" ,
167
178
GenerateName : "prefix" ,
168
179
UID : "uid" ,
@@ -182,6 +193,13 @@ func TestGenericTypeMetaAccessor(t *testing.T) {
182
193
if e , a := "bar" , namespace ; e != a {
183
194
t .Errorf ("expected %v, got %v" , e , a )
184
195
}
196
+ tenant , err := accessor .Tenant (j )
197
+ if err != nil {
198
+ t .Errorf ("unexpected error: %v" , err )
199
+ }
200
+ if e , a := "hah" , tenant ; e != a {
201
+ t .Errorf ("expected %v, got %v" , e , a )
202
+ }
185
203
name , err := accessor .Name (j )
186
204
if err != nil {
187
205
t .Errorf ("unexpected error: %v" , err )
@@ -249,6 +267,9 @@ func TestGenericTypeMetaAccessor(t *testing.T) {
249
267
if err := accessor .SetNamespace (j , "baz" ); err != nil {
250
268
t .Errorf ("unexpected error: %v" , err )
251
269
}
270
+ if err := accessor .SetTenant (j , "uau" ); err != nil {
271
+ t .Errorf ("unexpected error: %v" , err )
272
+ }
252
273
if err := accessor .SetName (j , "bar" ); err != nil {
253
274
t .Errorf ("unexpected error: %v" , err )
254
275
}
@@ -282,6 +303,9 @@ func TestGenericTypeMetaAccessor(t *testing.T) {
282
303
if e , a := "baz" , j .TypeMeta .Namespace ; e != a {
283
304
t .Errorf ("expected %v, got %v" , e , a )
284
305
}
306
+ if e , a := "uau" , j .TypeMeta .Tenant ; e != a {
307
+ t .Errorf ("expected %v, got %v" , e , a )
308
+ }
285
309
if e , a := "bar" , j .TypeMeta .Name ; e != a {
286
310
t .Errorf ("expected %v, got %v" , e , a )
287
311
}
@@ -318,6 +342,7 @@ func TestGenericObjectMeta(t *testing.T) {
318
342
}
319
343
type ObjectMeta struct {
320
344
Namespace string `json:"namespace,omitempty"`
345
+ Tenant string `json:"tenant,omitempty"`
321
346
Name string `json:"name,omitempty"`
322
347
GenerateName string `json:"generateName,omitempty"`
323
348
UID string `json:"uid,omitempty"`
@@ -338,6 +363,7 @@ func TestGenericObjectMeta(t *testing.T) {
338
363
},
339
364
ObjectMeta {
340
365
Namespace : "bar" ,
366
+ Tenant : "hah" ,
341
367
Name : "foo" ,
342
368
GenerateName : "prefix" ,
343
369
UID : "uid" ,
@@ -354,6 +380,9 @@ func TestGenericObjectMeta(t *testing.T) {
354
380
if e , a := "bar" , accessor .Namespace (); e != a {
355
381
t .Errorf ("expected %v, got %v" , e , a )
356
382
}
383
+ if e , a := "hah" , accessor .Tenant (); e != a {
384
+ t .Errorf ("expected %v, got %v" , e , a )
385
+ }
357
386
if e , a := "foo" , accessor .Name (); e != a {
358
387
t .Errorf ("expected %v, got %v" , e , a )
359
388
}
@@ -383,6 +412,7 @@ func TestGenericObjectMeta(t *testing.T) {
383
412
}
384
413
385
414
accessor .SetNamespace ("baz" )
415
+ accessor .SetTenant ("uau" )
386
416
accessor .SetName ("bar" )
387
417
accessor .SetGenerateName ("generate" )
388
418
accessor .SetUID ("other" )
@@ -397,6 +427,9 @@ func TestGenericObjectMeta(t *testing.T) {
397
427
if e , a := "baz" , j .Namespace ; e != a {
398
428
t .Errorf ("expected %v, got %v" , e , a )
399
429
}
430
+ if e , a := "uau" , j .Tenant ; e != a {
431
+ t .Errorf ("expected %v, got %v" , e , a )
432
+ }
400
433
if e , a := "bar" , j .Name ; e != a {
401
434
t .Errorf ("expected %v, got %v" , e , a )
402
435
}
0 commit comments