forked from kubevirt/kubevirt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubevirt#3973 from xpivarc/fix-clock-timezone
Fix clock timezone
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1373,6 +1373,46 @@ var _ = Describe("Configurations", func() { | |
}) | ||
}) | ||
|
||
Context("with Clock and timezone", func() { | ||
|
||
It("guest should see timezone", func() { | ||
vmi := tests.NewRandomVMIWithEphemeralDiskAndUserdata(cd.ContainerDiskFor(cd.ContainerDiskCirros), "#!/bin/bash\necho 'hello'\n") | ||
timezone := "America/New_York" | ||
tz := v1.ClockOffsetTimezone(timezone) | ||
vmi.Spec.Domain.Clock = &v1.Clock{ | ||
ClockOffset: v1.ClockOffset{ | ||
Timezone: &tz, | ||
}, | ||
Timer: &v1.Timer{}, | ||
} | ||
|
||
By("Creating a VMI with timezone set") | ||
vmi, err := virtClient.VirtualMachineInstance(tests.NamespaceTestDefault).Create(vmi) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
By("Waiting for succesful start of VMI") | ||
tests.WaitForSuccessfulVMIStart(vmi) | ||
|
||
By("Logging to VMI") | ||
expecter, err := tests.LoggedInCirrosExpecter(vmi) | ||
Expect(err).ToNot(HaveOccurred()) | ||
defer expecter.Close() | ||
|
||
loc, err := time.LoadLocation(timezone) | ||
Expect(err).ToNot(HaveOccurred()) | ||
now := time.Now().In(loc) | ||
|
||
By("Checking hardware clock time") | ||
expected := fmt.Sprintf("%02d:%02d:", now.Hour(), now.Minute()) | ||
_, err = expecter.ExpectBatch([]expect.Batcher{ | ||
&expect.BSnd{S: "sudo hwclock --localtime \n"}, | ||
&expect.BExp{R: expected}, | ||
}, 15*time.Second) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
}) | ||
}) | ||
|
||
}) | ||
|
||
Context("[rfe_id:140][crit:medium][vendor:[email protected]][level:component]with CPU spec", func() { | ||
|