Open praveenkumar opened 1 year ago
I tested #251 with cluster-bot release image and it works, I will also add the nightly or ec bits which have this commit if someone wants to test it
It's a bug in the unit test which became apparent after upgrading go-mock to its latest version. The test was missing:
diff --git a/pkg/cloud/libvirt/actuators/machine/actuator_test.go b/pkg/cloud/libvirt/actuators/machine/actuator_test.go
index a0ca8290..7a5771c0 100644
--- a/pkg/cloud/libvirt/actuators/machine/actuator_test.go
+++ b/pkg/cloud/libvirt/actuators/machine/actuator_test.go
@@ -213,6 +213,7 @@ func TestMachineEvents(t *testing.T) {
default:
t.Errorf("Expected %q event, got none", tc.event)
}
+ mockCtrl.Finish()
})
}
}
It was only seeming to succeed because Finish()
was never called. When upgrading go-mock from 1.3.x to 1.6.0, we get this commit https://github.com/golang/mock/commit/6d816de489c18a7e9a8fbd2aa5bb2dd75f2bbc86 which automatically calls Finish()
at the end of the test and makes it obvious that the test is broken.
diff --git a/pkg/cloud/libvirt/actuators/machine/actuator_test.go b/pkg/cloud/libvirt/actuators/machine/actuator_test.go
index fa89e42e..72502883 100644
--- a/pkg/cloud/libvirt/actuators/machine/actuator_test.go
+++ b/pkg/cloud/libvirt/actuators/machine/actuator_test.go
@@ -190,12 +190,12 @@ func TestMachineEvents(t *testing.T) {
},
}
- mockLibvirtClient.EXPECT().Close()
+ mockLibvirtClient.EXPECT().Close().AnyTimes()
mockLibvirtClient.EXPECT().CreateVolume(gomock.Any()).Return(tc.createVolumeErr).AnyTimes()
mockLibvirtClient.EXPECT().DeleteVolume(gomock.Any()).Return(tc.deleteVolumeErr).AnyTimes()
mockLibvirtClient.EXPECT().CreateDomain(context.TODO(), gomock.Any()).Return(tc.createDomainErr).AnyTimes()
mockLibvirtClient.EXPECT().DeleteDomain(gomock.Any()).Return(tc.deleteDomainErr).AnyTimes()
- mockLibvirtClient.EXPECT().GetDHCPLeasesByNetwork(gomock.Any())
+ mockLibvirtClient.EXPECT().GetDHCPLeasesByNetwork(gomock.Any()).AnyTimes()
mockLibvirtClient.EXPECT().LookupDomainByName(gomock.Any()).Return(tc.lookupDomainOutput, tc.lookupDomainErr).AnyTimes()
mockLibvirtClient.EXPECT().DomainExists(gomock.Any()).Return(tc.domainExists, tc.domainExistsErr).AnyTimes()
This allows the test to succeed but I'm unconvinced it's a great fix, this basically says "the mock interface expects all these methods to be called 0 or more times", this is not testing a lot. These expectations should probably be set per test-case rather than globally.
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle rotten /remove-lifecycle stale
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting /reopen
.
Mark the issue as fresh by commenting /remove-lifecycle rotten
.
Exclude this issue from closing again by commenting /lifecycle frozen
.
/close
@openshift-bot: Closing this issue.
/reopen
This is still not fixed.
/lifecycle frozen
@praveenkumar: Reopened this issue.
With #249 the actuator tests are failing like below and this issue is to track so we can fix it later in time. As of now priority is to update latest machine api and vendoring part.