Change output time format to unix #122

Merged
d.zayakin merged 1 commit from d.zayakin/frostfs-testlib:change-time-to-unix into master 2023-11-20 14:17:26 +00:00

View file

@ -410,8 +410,8 @@ class ClusterStateController:
@reporter.step_deco("Set node time to {in_date}")
def change_node_date(self, node: ClusterNode, in_date: datetime) -> None:
shell = node.host.get_shell()
shell.exec(f"hwclock --set --date='{in_date}'")
shell.exec("hwclock --hctosys")
shell.exec(f"date -s @{time.mktime(in_date.timetuple())}")
shell.exec("hwclock --systohc")
node_time = self.get_node_date(node)
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)
@ -421,8 +421,8 @@ class ClusterStateController:
shell = node.host.get_shell()
now_time = datetime.datetime.now(datetime.timezone.utc)
with reporter.step(f"Set {now_time} time"):
shell.exec(f"hwclock --set --date='{now_time}'")
shell.exec("hwclock --hctosys")
shell.exec(f"date -s @{time.mktime(now_time.timetuple())}")
shell.exec("hwclock --systohc")
@reporter.step_deco("Change the synchronizer status to {status}")
def set_sync_date_all_nodes(self, status: str):