-
Notifications
You must be signed in to change notification settings - Fork 102
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
MGMT-19148: Add options parameter to ListJobs
#938
MGMT-19148: Add options parameter to ListJobs
#938
Conversation
This change was partially done in the past, but the _Dockerfile_ wasn't updated to use the new `mockgen` command. As a result if one installs the `mockgen` with the command from the dockerfile and then runs `make generate` the resulting code doesn't build: ``` $ grep mockgen Dockerfile.assisted-installer-build go install github.com/golang/mock/[email protected] && \ $ go install github.com/golang/mock/[email protected] $ make generate go generate .. make format make[1]: Entering directory '/files/projects/assisted-installer/repository' make[1]: Leaving directory '/files/projects/assisted-installer/repository' $ make build CGO_ENABLED=0 go build -o build/installer src/main/main.go src/main/drymock/dry_mode_k8s_mock.go:308:36: cannot use mockController (variable of type *"go.uber.org/mock/gomock".Controller) as *"github.com/golang/mock/gomock".Controller value in argument to k8s_client.NewMockK8SClient make: *** [Makefile:68: installer] Error 1 ``` To avoid this issue this patch updates the _Dockerfile_, the generated code and the test code so that they use the same version of the mock package. Note that this wasn't detected by CI because we aren't running `make generate`. Signed-off-by: Juan Hernandez <[email protected]>
This patch adds a new `options metav1.ListOptions` parameter to the `ListJobs` method of Kubernetes client interface. This new parameter will be needed in order to add support for waiting for operator setup jobs, because that will need to list jobs in all namespaces using a label selector. In addition to adding the options the patch also changes the mock configuration so that they are more precise. Instead of this: ```go mockk8sclient.EXPECT().ListJobs(gomock.Any(), gomock.Any()) ``` We use this now: ```go mockk8sclient.EXPECT().ListJobs(olmNamespace, metav1.ListOptions{}) ``` That will help when introducing other tests where the parameters will be different. Related: https://issues.redhat.com/browse/MGMT-19148 Related: https://issues.redhat.com/browse/MGMT-19056 Signed-off-by: Juan Hernandez <[email protected]>
@jhernand: This pull request references MGMT-19148 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.18.0" version, but no target version was set. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jhernand The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #938 +/- ##
=======================================
Coverage 55.19% 55.19%
=======================================
Files 15 15
Lines 3279 3279
=======================================
Hits 1810 1810
Misses 1290 1290
Partials 179 179
|
@jhernand: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
/lgtm |
This is no longer needed because #940 was closed. |
This patch adds a new
options metav1.ListOptions
parameter to theListJobs
method of Kubernetes client interface. This new parameter will be needed in order to add support for waiting for operator setup jobs, because that will need to list jobs in all namespaces using a label selector.In addition to adding the options the patch also changes the mock configuration so that they are more precise. Instead of this:
We use this now:
That will help when introducing other tests where the parameters will be
different.
Related: https://issues.redhat.com/browse/MGMT-19148
Related: https://issues.redhat.com/browse/MGMT-19056