Compare commits
5 Commits
pdf
...
fix-update
Author | SHA1 | Date | |
---|---|---|---|
f5daf72598 | |||
82d841953a | |||
30851dd5df | |||
4989570371 | |||
a7a4f676e0 |
File diff suppressed because it is too large
Load Diff
@ -21,8 +21,45 @@ Tests for `otc-metadata` module.
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from otc_metadata import services
|
||||
|
||||
|
||||
class TestOtcMetadata(TestCase):
|
||||
def setUp(self):
|
||||
self.data = services.Services()
|
||||
|
||||
def test_something(self):
|
||||
pass
|
||||
def test_data_is_sorted(self):
|
||||
curr = self.data
|
||||
new = services.Services()
|
||||
new._sort_data()
|
||||
self.assertEqual(
|
||||
curr._service_data, new._service_data, "Data is sorted properly"
|
||||
)
|
||||
|
||||
def test_service_categories(self):
|
||||
category = dict()
|
||||
for cat in self.data._service_data["service_categories"]:
|
||||
category[cat["name"]] = cat["title"]
|
||||
for srv in self.data.all_services:
|
||||
self.assertTrue(
|
||||
srv["service_category"] in category,
|
||||
f"Category {srv['service_category']} is present",
|
||||
)
|
||||
|
||||
def test_doc_contains_required_data(self):
|
||||
srv_types = dict()
|
||||
for srv in self.data.all_services:
|
||||
srv_types[srv["service_type"]] = srv
|
||||
for doc in self.data.all_docs:
|
||||
for attr in [
|
||||
"rst_location",
|
||||
"service_type",
|
||||
"title",
|
||||
"type",
|
||||
]:
|
||||
self.assertIn(attr, doc, f"Document {doc} contains {attr}")
|
||||
self.assertIn(
|
||||
doc["service_type"],
|
||||
srv_types,
|
||||
f"Document {doc} contains valid service_type",
|
||||
)
|
||||
|
@ -4,4 +4,4 @@
|
||||
|
||||
stestr>=2.0.0 # Apache-2.0
|
||||
testtools>=2.2.0 # MIT
|
||||
flake8
|
||||
flake8>=6.0
|
||||
|
@ -149,8 +149,9 @@ def process_repositories(args, service):
|
||||
"-hc-int-jobs" if args.environment == "internal" else "-hc-jobs"
|
||||
)
|
||||
for doc in data.docs_by_service_type(service["service_type"]):
|
||||
logging.debug(f"Analyzing document {doc}")
|
||||
logging.info("Analyzing document %s" % doc)
|
||||
if not doc.get("type"):
|
||||
logging.debug("Skipping unsupported type")
|
||||
continue
|
||||
if doc["type"] == "dev":
|
||||
doc_type = "dev-guide"
|
||||
@ -158,7 +159,11 @@ def process_repositories(args, service):
|
||||
doc_type = doc["type"]
|
||||
template_name = f"{doc_type}{job_suffix}"
|
||||
if doc_type in ["api-ref", "umn", "dev-guide"]:
|
||||
logging.debug(
|
||||
"Ensuring required zuul template %s is present" % template_name)
|
||||
if template_name not in zuul_templates:
|
||||
logging.debug("Adding template %s" % template_name)
|
||||
zuul_config_updated = True
|
||||
zuul_templates.append(template_name)
|
||||
else:
|
||||
job_name = f"build-otc-{doc['service_type']}-{doc_type}"
|
||||
@ -245,6 +250,8 @@ def process_repositories(args, service):
|
||||
head=branch_name,
|
||||
),
|
||||
)
|
||||
else:
|
||||
logging.info("No update is necessary")
|
||||
|
||||
|
||||
def main():
|
||||
|
1
tox.ini
1
tox.ini
@ -19,7 +19,6 @@ commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
|
||||
show-source = True
|
||||
ignore = E123,E125,W503
|
||||
builtins = _
|
||||
|
Reference in New Issue
Block a user