-
Notifications
You must be signed in to change notification settings - Fork 256
MGMT-23548: Ensure tests w/ gomock controllers call Finish() #10024
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -81,7 +81,6 @@ var _ = Describe("domainNameResolution", func() { | |
| It("Missing cluster name", func() { | ||
| cluster = common.Cluster{Cluster: models.Cluster{ID: &clusterID, BaseDNSDomain: baseDNSDomain}} | ||
| Expect(db.Create(&cluster).Error).ShouldNot(HaveOccurred()) | ||
| mockVersions.EXPECT().GetReleaseImage(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&models.ReleaseImage{URL: swag.String("quay.io/release")}, nil) | ||
| stepReply, stepErr = dCmd.GetSteps(ctx, &host) | ||
| Expect(stepReply).To(BeNil()) | ||
| Expect(stepErr).To(HaveOccurred()) | ||
|
|
@@ -90,7 +89,6 @@ var _ = Describe("domainNameResolution", func() { | |
| It("Missing domain base name", func() { | ||
| cluster = common.Cluster{Cluster: models.Cluster{ID: &clusterID, Name: name}} | ||
| Expect(db.Create(&cluster).Error).ShouldNot(HaveOccurred()) | ||
| mockVersions.EXPECT().GetReleaseImage(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).Return(&models.ReleaseImage{URL: swag.String("quay.io/release")}, nil) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handling for the error covered by this spec happens before |
||
| stepReply, stepErr = dCmd.GetSteps(ctx, &host) | ||
| Expect(stepReply).To(BeNil()) | ||
| Expect(stepErr).To(HaveOccurred()) | ||
|
|
@@ -100,5 +98,6 @@ var _ = Describe("domainNameResolution", func() { | |
| common.DeleteTestDB(db, dbName) | ||
| stepReply = nil | ||
| stepErr = nil | ||
| ctrl.Finish() | ||
| }) | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,7 @@ var _ = Describe("setHeaders", func() { | |
| }) | ||
| AfterEach(func() { | ||
| common.DeleteTestDB(db, dbName) | ||
| ctrl.Finish() | ||
| }) | ||
|
|
||
| It("correctly sets the request header with a valid auth token", func() { | ||
|
|
@@ -192,6 +193,7 @@ var _ = Describe("prepareFiles", func() { | |
|
|
||
| AfterEach(func() { | ||
| common.DeleteTestDB(db, dbName) | ||
| ctrl.Finish() | ||
| }) | ||
|
|
||
| It("successfully prepares all files", func() { | ||
|
|
@@ -377,6 +379,7 @@ var _ = Describe("UploadEvents", func() { | |
| }) | ||
| AfterEach(func() { | ||
| common.DeleteTestDB(db, dbName) | ||
| ctrl.Finish() | ||
| }) | ||
| It("successfully uploads event data", func() { | ||
| event := models.Event{ | ||
|
|
@@ -419,20 +422,12 @@ var _ = Describe("UploadEvents", func() { | |
| }) | ||
| It("fails to uploads event data when malformed pullsecret", func() { | ||
| createOCMPullSecretWithEmptyToken(*mockK8sClient) | ||
| mockEvents.EXPECT().V2GetEvents( | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handling for the error covered by this spec happens before |
||
| ctx, common.GetDefaultV2GetEventsParams(&clusterID, nil, nil, models.EventCategoryMetrics, models.EventCategoryUser)). | ||
| Return(&common.V2GetEventsResponse{}, nil).Times(1) | ||
|
|
||
| cluster := createTestObjects(db, &clusterID, &hostID, &infraEnvID) | ||
| err := uploader.UploadEvents(ctx, cluster, mockEvents) | ||
| Expect(err.Error()).To(MatchRegexp(`.*failed to get pull secrets to upload event data for cluster.*`)) | ||
| }) | ||
| It("fails to uploads event data when pullsecret not found", func() { | ||
| createOCMPullSecretNotFound(*mockK8sClient) | ||
| mockEvents.EXPECT().V2GetEvents( | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handling for the error covered by this spec happens before |
||
| ctx, common.GetDefaultV2GetEventsParams(&clusterID, nil, nil, models.EventCategoryMetrics, models.EventCategoryUser)). | ||
| Return(&common.V2GetEventsResponse{}, nil).Times(1) | ||
|
|
||
| cluster := createTestObjects(db, &clusterID, &hostID, &infraEnvID) | ||
| err := uploader.UploadEvents(ctx, cluster, mockEvents) | ||
| Expect(err.Error()).To(MatchRegexp(`.*failed to get pull secrets to upload event data for cluster.*`)) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Handling for the error covered by this spec happens before
GetReleaseImageis called