-
Notifications
You must be signed in to change notification settings - Fork 11
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
Improve the end-to-end tests and fix the issue with 'BeforeEach' code block #118
Conversation
@@ -63,7 +63,7 @@ jobs: | |||
|
|||
- name: Deploy vcsim | |||
run: | | |||
kubectl create deployment vcsim --image=docker.io/vmware/vcsim | |||
make deploy-vsphere-simulator |
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 is cool! With this we can deploy multiple vcsims and test multiple environemnts :)
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.
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.
Thank's. Yes, it's much more convenient and also provides the flexibility to override the arguments passed to the container's ENTRYPOINT, allowing the simulator to be loaded with customizations.
b8080e9
to
c37cdf2
Compare
…ch causes errors when running more than one test. Signed-off-by: Aviel Segev <[email protected]>
c37cdf2
to
21148e1
Compare
@@ -132,7 +132,7 @@ func testVmwareConnection(requestCtx context.Context, credentials *config.Creden | |||
err = client.Login(ctx, u.User) | |||
if err != nil { | |||
err = liberr.Wrap(err) | |||
if strings.Contains(err.Error(), "incorrect") && strings.Contains(err.Error(), "password") { | |||
if strings.Contains(err.Error(), "Login failure") { |
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.
Can you double check this works also in real env?
Hi,
This PR introduces four additional test cases as part of the end-to-end (e2e) tests to validate login behavior under the following scenarios:
To ensure these tests pass, this PR also addresses the following issues:
BeforeEach and AfterEach Conflict:
Previously, the afterEach block did not remove agent records from the database, even though the associated VM was deleted. This caused failures in the beforeEach block due to unexpected matches between newly created agents and old database records. This has now been fixed.
Error Handling in testVmwareConnection:
When an error occurred in the testVmwareConnection method, the expected behavior was to return:
Unauthorized (401) for invalid credentials
BadRequest (400) for other errors
However, this logic was broken due to a if statement that checked wrong substring compare to what returned by the vCenter client. The issue has been resolved.
Additionally, the Vcsim (vSphere simulator) used in the e2e tests is now configured with a core username and password (123456) instead of allowing any non-empty credentials by default.