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

[integration] timesync test #3461

Closed
wants to merge 1 commit into from

Conversation

adrianriobo
Copy link
Contributor

This test ensures the timesync feature works as expected for darwin platform

    this is an integration test for timesync feature introduced in commit db63999
@openshift-ci
Copy link

openshift-ci bot commented Dec 20, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from adrianriobo by writing /assign @adrianriobo in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@adrianriobo
Copy link
Contributor Author

/hold

@openshift-ci
Copy link

openshift-ci bot commented Dec 20, 2022

@adrianriobo: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/integration-crc c0cbc4f link true /test integration-crc

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/test-infra repository. I understand the commands that are listed here.

Copy link

@jsliacan jsliacan left a comment

Choose a reason for hiding this comment

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

I haven't actually checked if this test is doing what it should be doing :).

"os/exec"
"strconv"

// "github.com/crc-org/crc/test/extended/crc/cmd".
Copy link

Choose a reason for hiding this comment

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

I guess this line can be removed?

. "github.com/onsi/gomega"
)

func startInstance() {
Copy link

@jsliacan jsliacan Jan 9, 2023

Choose a reason for hiding this comment

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

I'd maybe call this startCRC() (inside it we can distinguish which bundle we start with) as the other functions are called CheckCRCStatus, etc. Not a strong suggestion, just mentioning it.

Copy link

Choose a reason for hiding this comment

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

BTW, there's a file called utilities_test.go where I put code like this: https://github.com/crc-org/crc/blob/e3054a158d9c6fad2e5641b7d5207a951287b576/test/integration/utilities_test.go. That said, recently we talked about moving this kind of code to a place which will be shared with e2e. I think I'm doing the same "start if not running" check here:

func EnsureCRCIsRunningSucceedsOrFails(expected string) error {
Maybe if you put this in extended we can later refactor it to be used in multiple places. Again, up to you.

Expect(exec.Command("pmset", "sleepnow").Run()).To(Succeed())
By("getting dates from instance and host")
out, err := exec.Command("date", "-u", "+%s").Output()
Expect(err).To(BeEmpty())
Copy link

Choose a reason for hiding this comment

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

I think elsewhere I'm using Expect(err).NotTo(HaveOccurred()). Can stay as it is if you prefer it.


var _ = Describe("Guest machine time should be in sync with host", Label("guest-timesync", "darwin"), func() {

BeforeSuite(func() {
Copy link

Choose a reason for hiding this comment

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

The way I understand BeforeSuite is that it acts globally (before each Describe block?), so it should probably be defined outside of it too, e.g. in testsuite_test.go. Here, maybe BeforeEach would work better?

That said, I am not sure if the It block wouldn't be better split into a few of them, in which case BeforeEach wouldn't work so well.

}
})

It("checks instance date is in sync with host after host suspension", func() {
Copy link

Choose a reason for hiding this comment

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

I'm not sure what good practice is in Ginkgo, but I imagine It blocks to be smaller. One of the reasons for this is that the results file is iterated by It blocks. If only one block present, then only one pass/fail result. Which is probably good for e2e test (?) but not sure about integration... More detail in the results might be easier to debug too. But I'm not an expert here, just suggesting!

@adrianriobo
Copy link
Contributor Author

I am keeping this PR on hold as I have been trying to ensure we can mimic the sleep mode on our qe envs, but I was not able for the moment. On AWS even scheduling with pmset the system seems to go for sleep but only for a second so tyme will not be out of sync for testing the feature

@adrianriobo
Copy link
Contributor Author

Close as I am not able to reproduce the scenario on remote machines

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Progress
Development

Successfully merging this pull request may close these issues.

[Integration] Add test around timesync for podman bundle
2 participants