@@ -45,6 +45,11 @@ import (
45
45
"sigs.k8s.io/controller-runtime/pkg/client/interceptor"
46
46
)
47
47
48
+ const (
49
+ machineIDFromStatusUpdate = "machine-id-from-status-update"
50
+ cidrFromStatusUpdate = "cidr-from-status-update"
51
+ )
52
+
48
53
var _ = Describe ("Fake client" , func () {
49
54
var dep * appsv1.Deployment
50
55
var dep2 * appsv1.Deployment
@@ -1456,15 +1461,15 @@ var _ = Describe("Fake client", func() {
1456
1461
cl := NewClientBuilder ().WithStatusSubresource (obj ).WithObjects (obj ).Build ()
1457
1462
objOriginal := obj .DeepCopy ()
1458
1463
1459
- obj .Spec .PodCIDR = "cidr-from-status-update"
1464
+ obj .Spec .PodCIDR = cidrFromStatusUpdate
1460
1465
obj .Annotations = map [string ]string {
1461
1466
"some-annotation-key" : "some-annotation-value" ,
1462
1467
}
1463
1468
obj .Labels = map [string ]string {
1464
1469
"some-label-key" : "some-label-value" ,
1465
1470
}
1466
1471
1467
- obj .Status .NodeInfo .MachineID = "machine-id-from-status-update"
1472
+ obj .Status .NodeInfo .MachineID = machineIDFromStatusUpdate
1468
1473
Expect (cl .Status ().Update (context .Background (), obj )).NotTo (HaveOccurred ())
1469
1474
1470
1475
actual := & corev1.Node {ObjectMeta : metav1.ObjectMeta {Name : obj .Name }}
@@ -1473,7 +1478,7 @@ var _ = Describe("Fake client", func() {
1473
1478
objOriginal .APIVersion = actual .APIVersion
1474
1479
objOriginal .Kind = actual .Kind
1475
1480
objOriginal .ResourceVersion = actual .ResourceVersion
1476
- objOriginal .Status .NodeInfo .MachineID = "machine-id-from-status-update"
1481
+ objOriginal .Status .NodeInfo .MachineID = machineIDFromStatusUpdate
1477
1482
Expect (cmp .Diff (objOriginal , actual )).To (BeEmpty ())
1478
1483
})
1479
1484
@@ -1494,7 +1499,7 @@ var _ = Describe("Fake client", func() {
1494
1499
cl := NewClientBuilder ().WithStatusSubresource (obj ).WithObjects (obj ).Build ()
1495
1500
expectedObj := obj .DeepCopy ()
1496
1501
1497
- obj .Status .NodeInfo .MachineID = "machine-id-from-status-update"
1502
+ obj .Status .NodeInfo .MachineID = machineIDFromStatusUpdate
1498
1503
Expect (cl .Status ().Update (context .Background (), obj )).NotTo (HaveOccurred ())
1499
1504
1500
1505
obj .Annotations = map [string ]string {
@@ -1511,7 +1516,7 @@ var _ = Describe("Fake client", func() {
1511
1516
expectedObj .APIVersion = actual .APIVersion
1512
1517
expectedObj .Kind = actual .Kind
1513
1518
expectedObj .ResourceVersion = actual .ResourceVersion
1514
- expectedObj .Status .NodeInfo .MachineID = "machine-id-from-status-update"
1519
+ expectedObj .Status .NodeInfo .MachineID = machineIDFromStatusUpdate
1515
1520
Expect (cmp .Diff (expectedObj , actual )).To (BeEmpty ())
1516
1521
})
1517
1522
@@ -1540,8 +1545,8 @@ var _ = Describe("Fake client", func() {
1540
1545
}
1541
1546
Expect (cl .Update (context .Background (), obj )).NotTo (HaveOccurred ())
1542
1547
1543
- obj .Spec .PodCIDR = "cidr-from-status-update"
1544
- obj .Status .NodeInfo .MachineID = "machine-id-from-status-update"
1548
+ obj .Spec .PodCIDR = cidrFromStatusUpdate
1549
+ obj .Status .NodeInfo .MachineID = machineIDFromStatusUpdate
1545
1550
Expect (cl .Status ().Update (context .Background (), obj )).NotTo (HaveOccurred ())
1546
1551
1547
1552
actual := & corev1.Node {ObjectMeta : metav1.ObjectMeta {Name : obj .Name }}
@@ -1550,7 +1555,7 @@ var _ = Describe("Fake client", func() {
1550
1555
expectedObj .APIVersion = actual .APIVersion
1551
1556
expectedObj .Kind = actual .Kind
1552
1557
expectedObj .ResourceVersion = actual .ResourceVersion
1553
- expectedObj .Status .NodeInfo .MachineID = "machine-id-from-status-update"
1558
+ expectedObj .Status .NodeInfo .MachineID = machineIDFromStatusUpdate
1554
1559
Expect (cmp .Diff (expectedObj , actual )).To (BeEmpty ())
1555
1560
})
1556
1561
@@ -1614,7 +1619,7 @@ var _ = Describe("Fake client", func() {
1614
1619
cl := NewClientBuilder ().WithStatusSubresource (obj ).WithObjects (obj ).Build ()
1615
1620
objOriginal := obj .DeepCopy ()
1616
1621
1617
- obj .Spec .PodCIDR = "cidr-from-status-update"
1622
+ obj .Spec .PodCIDR = cidrFromStatusUpdate
1618
1623
obj .Status .NodeInfo .MachineID = "machine-id"
1619
1624
Expect (cl .Status ().Patch (context .Background (), obj , client .MergeFrom (objOriginal ))).NotTo (HaveOccurred ())
1620
1625
0 commit comments