From 58041629d555161b62687ad22008f8d66691880d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu>
Date: Tue, 16 May 2017 18:52:15 +0200
Subject: [PATCH] port backup test for rsync_tmbackup, refs #21504

---
 tests/test_backup.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/test_backup.py b/tests/test_backup.py
index 06222029..97fc679f 100755
--- a/tests/test_backup.py
+++ b/tests/test_backup.py
@@ -8,6 +8,7 @@ Checks that the server backups are not older than a day.
 from datetime import datetime
 import imp
 import os
+import socket
 import subprocess
 import sys
 
@@ -29,8 +30,9 @@ def test_ssh(ip):
     return True
 
 
-def test_last_backup_is_recent(server, client):
-    path = '/backup/%s/current' % client
+def test_last_backup_is_recent(server):
+    client = socket.gethostname()
+    path = '/backup/%s/home/current' % client
     cmd = 'ssh -o StrictHostKeyChecking=no %s ls -l %s | grep current' % (server, path)
     status, out = subprocess.getstatusoutput(cmd)
     if status == 0:
@@ -53,13 +55,12 @@ if os.path.isfile('../utils.py'):
     es_utils = imp.load_source('es_utils', '../utils.py')
     conf = es_utils.load_conf()
     BURP_SERVER = conf.get('BURP_SERVER')
-    BURP_CLIENT_NAME = conf.get('BURP_CLIENT_NAME') or 'localhost'
     if BURP_SERVER:
         if not test_ssh(BURP_SERVER):
             print('Failed to ssh into backup server')
             sys.exit(1)
         else:
-            if not test_last_backup_is_recent(BURP_SERVER, BURP_CLIENT_NAME):
+            if not test_last_backup_is_recent(BURP_SERVER):
                 sys.exit(1)
             else:
                 sys.exit(0)
-- 
GitLab