Skip to content

Commit

Permalink
add test fixes for fake client changes
Browse files Browse the repository at this point in the history
This change adds a few fixes to the tests that are using the fake
client, in specific these changes are related to this controller runtime
change[0].

[0] kubernetes-sigs/controller-runtime#1306
  • Loading branch information
elmiko committed Apr 14, 2021
1 parent de04079 commit 00aebee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Expand Up @@ -1171,6 +1171,8 @@ func TestGetTargetsFromMHC(t *testing.T) {
machineAnnotationKey: fmt.Sprintf("%s/%s", namespace, "match1"),
},
Labels: map[string]string{},
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
ResourceVersion: "999",
},
TypeMeta: metav1.TypeMeta{
Kind: "Node",
Expand Down Expand Up @@ -1238,6 +1240,8 @@ func TestGetTargetsFromMHC(t *testing.T) {
machineAnnotationKey: fmt.Sprintf("%s/%s", namespace, "match1"),
},
Labels: map[string]string{},
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
ResourceVersion: "999",
},
TypeMeta: metav1.TypeMeta{
Kind: "Node",
Expand Down Expand Up @@ -1300,6 +1304,8 @@ func TestGetTargetsFromMHC(t *testing.T) {
Namespace: namespace,
Labels: map[string]string{"foo": "bar"},
OwnerReferences: []metav1.OwnerReference{{Kind: "MachineSet"}},
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
ResourceVersion: "999",
},
Spec: mapiv1beta1.MachineSpec{},
Status: mapiv1beta1.MachineStatus{},
Expand All @@ -1323,6 +1329,8 @@ func TestGetTargetsFromMHC(t *testing.T) {
ObjectMeta: metav1.ObjectMeta{
Name: "node1",
Namespace: metav1.NamespaceNone,
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
ResourceVersion: "999",
},
},
},
Expand Down
4 changes: 4 additions & 0 deletions pkg/util/testing/testing.go
Expand Up @@ -118,6 +118,8 @@ func NewMachine(name string, nodeName string) *mapiv1.Machine {
Controller: pointer.BoolPtr(true),
},
},
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
ResourceVersion: "999",
},
Spec: mapiv1.MachineSpec{},
}
Expand All @@ -138,6 +140,8 @@ func NewMachineHealthCheck(name string) *mapiv1.MachineHealthCheck {
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: Namespace,
// the following line is to account for a change in the fake client, see https://github.com/kubernetes-sigs/controller-runtime/pull/1306
ResourceVersion: "999",
},
TypeMeta: metav1.TypeMeta{
Kind: "MachineHealthCheck",
Expand Down

0 comments on commit 00aebee

Please sign in to comment.