-
Notifications
You must be signed in to change notification settings - Fork 32
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
rewrite unit-tests with ginkgo #142
Conversation
Hi @sankalp-r. Thanks for your PR. I'm waiting for a kubevirt member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
/ok-to-test |
/assign @mfranczy |
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.
Please rebase your PR against the lastet changes.
18a6e4d
to
1f2bcb8
Compare
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.
@sankalp-r let's avoid having complex logic in tests that based on the input differs with result. The test scenario should be simple and easy to read. We can sync on that before you make another changes.
pkg/provider/loadbalancer_test.go
Outdated
|
||
}) | ||
|
||
DescribeTable("Ensure loadbalancer", func(checkSvcExistErr error, getCount int, portsChanged bool, updateSvcErr error, createSvcErr error, pollSvcErr error, expectedError error) { |
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.
This test is too complex, we should divide that into multiple scenarios instead of implementing a complex logic for DescribeTable
. Let's cover this with It("Should <description of the case>")
.
pkg/provider/loadbalancer_test.go
Outdated
|
||
}) | ||
|
||
DescribeTable("Update loadbalancer", func(getSvcErr error, updateSvcErr error, expectedError error, portsChanged bool) { |
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.
Same as my above comment, let's avoid having a complex logic for tests.
Signed-off-by: Sankalp Rangare <sankalprangare786@gmail.com>
1f2bcb8
to
32c9bd4
Compare
pkg/provider/loadbalancer_test.go
Outdated
t.Errorf("Expected: '%v', got '%v'", test.expectedError, err) | ||
} | ||
} | ||
func copyService(src *corev1.Service, dst *corev1.Service) { |
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.
why not DeepCopy()
?
pkg/provider/loadbalancer_test.go
Outdated
|
||
for i := 0; i < getCount; i++ { | ||
infraService2 := &corev1.Service{} | ||
copyService(infraService1, infraService2) |
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.
please use infraService1.DeepCopy()
instead of copyService
that can be removed.
Signed-off-by: Sankalp Rangare <sankalprangare786@gmail.com>
d98e256
to
6417efe
Compare
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.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mfranczy 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 |
Fixes: #91
Signed-off-by: Sankalp Rangare sankalprangare786@gmail.com