]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Fix get_http_log_path(), update callers, add tests 90/head
authorZack Cerza <zack@cerza.org>
Thu, 12 Sep 2013 22:28:50 +0000 (17:28 -0500)
committerZack Cerza <zack@cerza.org>
Thu, 12 Sep 2013 22:28:50 +0000 (17:28 -0500)
teuthology/misc.py
teuthology/suite.py
teuthology/test/test_misc.py

index 0d154b5fadc319ea2dd043cb67d3b32f4d673e68..f5a4e44c264aec8ebd509797a489d8a2fd07c87c 100644 (file)
@@ -53,7 +53,14 @@ def get_http_log_path(archive_dir, job_id=None):
     http_base = config.archive_server
     if not http_base:
         return None
-    archive_subdir = os.path.split(archive_dir)[-1]
+
+    sep = os.path.sep
+    archive_subdir = archive_dir.split(sep)[-1]
+    if archive_subdir.endswith(str(job_id)):
+        archive_subdir = archive_dir.split(sep)[-2]
+
+    print archive_subdir
+
     if job_id is None:
         return os.path.join(http_base, archive_subdir, '')
     return os.path.join(http_base, archive_subdir, str(job_id), '')
index 1c9e571243a1e565022012c8746935cfc20c41b1..d6f0abe3ad171fdfdf54d2423ca770988554dbef 100644 (file)
@@ -593,7 +593,7 @@ def build_email_body(name, archive_dir, timeout):
 
     body = email_templates['body_templ'].format(
         name=name,
-        log_root=misc.get_http_log_path(archive_dir, ''),
+        log_root=misc.get_http_log_path(archive_dir),
         fail_count=len(failed),
         hung_count=len(hung),
         pass_count=len(passed),
index 5e38c3fb01c5574a50cc9dd3a943ba44457a9981..1e71842fb9307bed223756454bee3b7d83715d47 100644 (file)
@@ -32,6 +32,7 @@ def test_get_clients_simple():
 
 
 def test_get_http_log_path():
+    # Fake configuration
     archive_server = "http://example.com/server_root"
     config.archive_server = archive_server
     archive_dir = "/var/www/archives"
@@ -42,3 +43,14 @@ def test_get_http_log_path():
     job_id = '12345'
     path = misc.get_http_log_path(archive_dir, job_id)
     assert_equal(path, "http://example.com/server_root/archives/12345/")
+
+    # Inktank configuration
+    archive_server = "http://qa-proxy.ceph.com/teuthology/"
+    config.archive_server = archive_server
+    archive_dir = "/var/lib/teuthworker/archive/teuthology-2013-09-12_11:49:50-ceph-deploy-master-testing-basic-vps"
+    job_id = 31087
+    path = misc.get_http_log_path(archive_dir, job_id)
+    assert_equal(path, "http://qa-proxy.ceph.com/teuthology/teuthology-2013-09-12_11:49:50-ceph-deploy-master-testing-basic-vps/31087/")
+
+    path = misc.get_http_log_path(archive_dir)
+    assert_equal(path, "http://qa-proxy.ceph.com/teuthology/teuthology-2013-09-12_11:49:50-ceph-deploy-master-testing-basic-vps/")