forked from TrueCloudLab/frostfs-testlib
Change output time format to unix
Signed-off-by: Dmitriy Zayakin <d.zayakin@yadro.com>
This commit is contained in:
parent
ed70dada96
commit
ed8f90dfc0
1 changed files with 4 additions and 4 deletions
|
@ -410,8 +410,8 @@ class ClusterStateController:
|
||||||
@reporter.step_deco("Set node time to {in_date}")
|
@reporter.step_deco("Set node time to {in_date}")
|
||||||
def change_node_date(self, node: ClusterNode, in_date: datetime) -> None:
|
def change_node_date(self, node: ClusterNode, in_date: datetime) -> None:
|
||||||
shell = node.host.get_shell()
|
shell = node.host.get_shell()
|
||||||
shell.exec(f"hwclock --set --date='{in_date}'")
|
shell.exec(f"date -s @{time.mktime(in_date.timetuple())}")
|
||||||
shell.exec("hwclock --hctosys")
|
shell.exec("hwclock --systohc")
|
||||||
node_time = self.get_node_date(node)
|
node_time = self.get_node_date(node)
|
||||||
with reporter.step(f"Verify difference between {node_time} and {in_date} is less than a minute"):
|
with reporter.step(f"Verify difference between {node_time} and {in_date} is less than a minute"):
|
||||||
assert (self.get_node_date(node) - in_date) < datetime.timedelta(minutes=1)
|
assert (self.get_node_date(node) - in_date) < datetime.timedelta(minutes=1)
|
||||||
|
@ -421,8 +421,8 @@ class ClusterStateController:
|
||||||
shell = node.host.get_shell()
|
shell = node.host.get_shell()
|
||||||
now_time = datetime.datetime.now(datetime.timezone.utc)
|
now_time = datetime.datetime.now(datetime.timezone.utc)
|
||||||
with reporter.step(f"Set {now_time} time"):
|
with reporter.step(f"Set {now_time} time"):
|
||||||
shell.exec(f"hwclock --set --date='{now_time}'")
|
shell.exec(f"date -s @{time.mktime(now_time.timetuple())}")
|
||||||
shell.exec("hwclock --hctosys")
|
shell.exec("hwclock --systohc")
|
||||||
|
|
||||||
@reporter.step_deco("Change the synchronizer status to {status}")
|
@reporter.step_deco("Change the synchronizer status to {status}")
|
||||||
def set_sync_date_all_nodes(self, status: str):
|
def set_sync_date_all_nodes(self, status: str):
|
||||||
|
|
Loading…
Reference in a new issue