From 621451511839b07c3fe68a3602b3ea4112de6ac2 Mon Sep 17 00:00:00 2001
From: Emanuele Aina <emanuele.aina@collabora.com>
Date: Wed, 21 Aug 2019 14:58:51 +0200
Subject: [PATCH] aum-ota-auto: Use timedatectl to workaround NTP issues on
 some networks

With battery backed devices on networks with no properly reachable NTP servers
the boards would fail to automatically get the right time, so testers set it up
manually with `date`.

However, the hardware clock need to be configured as well for the time
configuration to survive a reboot, needed by the Apertis update manager OTA
test.

Without this, the device will fail to establish any TLS connection after the
reboot since every certificate will look like they are out of their validity
period.

This is only a workaround until we ensure NTP servers are reachable on the
testers' network, see https://phabricator.apertis.org/T6115

Fixes: https://phabricator.apertis.org/T6284

Signed-off-by: Emanuele Aina <emanuele.aina@collabora.com>
---
 test-cases/apertis-update-manager-ota-auto.yaml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/test-cases/apertis-update-manager-ota-auto.yaml b/test-cases/apertis-update-manager-ota-auto.yaml
index 57141c4..b637f2d 100644
--- a/test-cases/apertis-update-manager-ota-auto.yaml
+++ b/test-cases/apertis-update-manager-ota-auto.yaml
@@ -11,6 +11,16 @@ metadata:
   maintainer: "Apertis Project"
   description: "Test the apertis-update-manager automatic updates over the air."
 
+  pre-conditions:
+    - >
+      This test requires a properly configured time source: when testing
+      devices not carrying a battery-backed real time clock in a network which
+      prevents connections to NTP servers (and only in that case) manually
+      ensure that the time on the device is set appropriately and that it is
+      propagated to the hardware clock so it is stay set on the next reboot if
+      the power is not plugged off.
+    - $ sudo timedatectl --adjust-system-clock set-time "2019-08-21 18:49:03" # use the appropriate date
+
   resources:
     - "The DUT u-boot environment must be clean: in u-boot, run: `env default -a` followed by `saveenv`"
     - "A PC must be connected to DUT serial port"
-- 
GitLab