diff --git a/tests/test_ntp.py b/tests/test_ntp.py
index eb42979673732b56a1055f9705759493c1def00e..dfd80df21a31d7f98e8beaaaad968b168a7f212d 100755
--- a/tests/test_ntp.py
+++ b/tests/test_ntp.py
@@ -36,14 +36,14 @@ print('Checking NTP server conforms to conf')
 if os.path.isfile('../utils.py'):
     es_utils = imp.load_source('es_utils', '../utils.py')
     conf = es_utils.load_conf()
-    expected_servers = (conf.get('NTP_SERVER') or 'ntp.ubuntu.com').split(',')
+    expected_servers = [s.strip() for s in (conf.get('NTP_SERVER') or 'ntp.ubuntu.com').split(',')]
 
     with open(ntpconf, 'r') as f:
         d = f.read()
         servers = list()
         for l in d.split('\n'):
             if l.startswith(ntpconf_expected):
-                servers.append(l[len(ntpconf_expected):])
+                servers.append(l[len(ntpconf_expected):].strip())
         for expected_server in expected_servers:
             if expected_server not in servers:
                 print('Expected NTP server %s not found in %s, found %s instead.' % (expected_server, ntpconf, servers))