]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
describe-tests: rename input element from 'description' to 'meta'
authorJosh Durgin <jdurgin@redhat.com>
Thu, 3 Dec 2015 02:54:33 +0000 (18:54 -0800)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 9 Dec 2015 21:04:54 +0000 (13:04 -0800)
teuthology-suite already uses a top-level description field that other
tools rely on. This is shorter to type too.

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
scripts/describe_tests.py
teuthology/describe_tests.py
teuthology/test/test_describe_tests.py

index 8f1777445b48c989a76f237cf9c6c0ebdd8be797..d121a244001db85bebc1abb4f85421448f5bec4c 100644 (file)
@@ -8,13 +8,13 @@ usage:
     teuthology-describe-tests -h
     teuthology-describe-tests [options] [--] <suite_dir>
 
-Describe the contents of a qa suite by reading 'description' elements
-from yaml files in the suite.
+Describe the contents of a qa suite by reading 'meta' elements from
+yaml files in the suite.
 
-The 'description' element should contain a list with a dictionary
+The 'meta' element should contain a list with a dictionary
 of key/value pairs for entries, i.e.:
 
-description:
+meta:
 - field1: value1
   field2: value2
   field3: value3
index 522f6148bdec349cc899cafe5667a1eb1609223a..858e23742b3a6e04e3df88066e1daac7be36edf0 100644 (file)
@@ -172,15 +172,15 @@ def extract_info(file_name, fields, _isdir=os.path.isdir, _open=open):
 
     Assumes fields are set in a format of:
 
-    {'description': [{'field' : value, 'field2' : value2}]
+    {'meta': [{'field' : value, 'field2' : value2}]
 
     or in yaml:
 
-    description:
+    meta:
     - field: value
       field2: value2
 
-    If description is present but not in this format, prints an error
+    If 'meta' is present but not in this format, prints an error
     message and raises ParseError.
     """
     empty_result = {f: '' for f in fields}
@@ -193,16 +193,16 @@ def extract_info(file_name, fields, _isdir=os.path.isdir, _open=open):
     if not isinstance(parsed, dict):
         return empty_result
 
-    description = parsed.get('description', [{}])
-    if not (isinstance(description, list) and
-            len(description) == 1 and
-            isinstance(description[0], dict)):
-        print 'Error in description format in', file_name
-        print 'Description must be a list containing exactly one dict.'
-        print 'Description is:', description
+    meta = parsed.get('meta', [{}])
+    if not (isinstance(meta, list) and
+            len(meta) == 1 and
+            isinstance(meta[0], dict)):
+        print 'Error in meta format in', file_name
+        print 'Meta must be a list containing exactly one dict.'
+        print 'Meta is:', meta
         raise ParseError()
 
-    return {field: description[0].get(field, '') for field in fields}
+    return {field: meta[0].get(field, '') for field in fields}
 
 def path_relative_to_suites(path):
     """Attempt to trim the ceph-qa-suite root directory from the beginning
index 1334304e8b0f5a117e4a5a98d93cb5436f5d6528..145fc7acec1f58bda452f6e68de542837ca167f9 100644 (file)
@@ -11,14 +11,14 @@ realistic_fs = {
         '%': None,
         'base': {
             'install.yaml':
-            """description:
+            """meta:
 - desc: install ceph
 install:
 """
         },
         'clusters': {
             'fixed-1.yaml':
-            """description:
+            """meta:
 - desc: single node cluster
 roles:
 - [osd.0, osd.1, osd.2, mon.a, mon.b, mon.c, client.0]
@@ -26,7 +26,7 @@ roles:
         },
         'workloads': {
             'rbd_api_tests_old_format.yaml':
-            """description:
+            """meta:
 - desc: c/c++ librbd api tests with format 1 images
   rbd_features: none
 overrides:
@@ -43,7 +43,7 @@ tasks:
         - rbd/test_librbd.sh
 """,
             'rbd_api_tests.yaml':
-            """description:
+            """meta:
 - desc: c/c++ librbd api tests with default settings
   rbd_features: default
 tasks:
@@ -223,7 +223,7 @@ class TestDescribeTests(object):
 
 
 def test_extract_info_dir():
-    simple_fs = {'a': {'b.yaml': 'description: [{foo: c}]'}}
+    simple_fs = {'a': {'b.yaml': 'meta: [{foo: c}]'}}
     _, _, fake_isdir, fake_open = make_fake_fstools(simple_fs)
     info = extract_info('a', [], fake_isdir, fake_open)
     assert info == {}
@@ -241,13 +241,13 @@ def check_parse_error(fs):
         raise Exception(str(a))
 
 def test_extract_info_too_many_elements():
-    check_parse_error({'a.yaml': 'description: [{a: b}, {b: c}]'})
+    check_parse_error({'a.yaml': 'meta: [{a: b}, {b: c}]'})
 
 def test_extract_info_not_a_list():
-    check_parse_error({'a.yaml': 'description: {a: b}'})
+    check_parse_error({'a.yaml': 'meta: {a: b}'})
 
 def test_extract_info_not_a_dict():
-    check_parse_error({'a.yaml': 'description: [[a, b]]'})
+    check_parse_error({'a.yaml': 'meta: [[a, b]]'})
 
 def test_extract_info_empty_file():
     simple_fs = {'a.yaml': ''}