Skip to content
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

Add unit tests #17

Merged
merged 9 commits into from Feb 10, 2021
Merged

Conversation

jsafrane
Copy link
Contributor

@jsafrane jsafrane commented Jan 8, 2021

  • Bump govc to the latest released version.
  • Add XMLs with 1 host, 2 node vSphere cluster to pkg/check/testdata/default - that's how a simulated vCenter will look like. Added README there to be able to re-generate it when needed, with special attention to simulated datastore (it needs a real directory on filesystem).
  • Add a simple test framework.
    • To start the simulator (loading the XMLs from filesystem) and serving a https endpoint.
    • To modify simulated vCenter hosts+VMs to test various scenarios.
    • To mock KubeClient with dummy API objects.
  • Add unit tests for most checks.
    • folder_test.go does not have any error cases, we would need to simulate permission errors.
    • No tests for tasks.go, did not find a way how to inject a task to the simulator.
    • No test for StorageClass with StoragePolicy - I'd need to add a few simulated objects. Deferring to subsequent PRs.

@openshift/storage

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jsafrane

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 8, 2021
@jsafrane
Copy link
Contributor Author

jsafrane commented Jan 8, 2021

/retest

@@ -0,0 +1,13 @@
Generated using vcsim and vcgo, both v0.23.1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: I think you mean govc ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also reads bit weird - it looks like as if this readme was generated.

@gnufied
Copy link
Member

gnufied commented Feb 8, 2021

lets merge this. we can fix readme in a follow up.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 8, 2021
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

17 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@jsafrane
Copy link
Contributor Author

jsafrane commented Feb 9, 2021

/lgtm cancel

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 9, 2021
To get the latest simulator
@jsafrane
Copy link
Contributor Author

jsafrane commented Feb 9, 2021

rebased

@jsafrane jsafrane force-pushed the add-unit-tests branch 3 times, most recently from 6de5bc6 to aaa28f3 Compare February 9, 2021 14:44
The framework uses vCenter simulator. It simulates objects previously
saved from "vcsim", i.e. some default vSpehere with 1 host + 2 VMs, and now
present in the repository as pkg/check/testdata/default/*.xml.
And fix a bug in the datastore checks.
@gnufied
Copy link
Member

gnufied commented Feb 9, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 9, 2021
@gnufied
Copy link
Member

gnufied commented Feb 9, 2021

/retest

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@gnufied
Copy link
Member

gnufied commented Feb 10, 2021

/retest

@openshift-merge-robot openshift-merge-robot merged commit cd9afcf into openshift:master Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants