From 0e67a2beeada5a8d8c166f24abcdacc65970ecee Mon Sep 17 00:00:00 2001 From: lrjball Date: Tue, 30 Mar 2021 00:00:16 +0100 Subject: [PATCH 1/2] Removed over-nesting in resources file and added test --- docs/nodes/openstack.md | 9 --------- ...{Internet-gateway.png => internet-gateway.png} | Bin .../{operations => }/billing/cloudkitty.png | Bin .../containerservices/kuryr.png | Bin .../deployment/ansible.png | Bin .../deployment/charms.png | Bin .../{lifecyclemanagement => }/deployment/chef.png | Bin .../{lifecyclemanagement => }/deployment/helm.png | Bin .../deployment/kolla.png | Bin .../deployment/tripleo.png | Bin .../{operations => }/monitoring/monasca.png | Bin .../{operations => }/monitoring/telemetry.png | Bin .../{operations => }/multiregion/tricircle.png | Bin .../{adjacentenablers => }/nfv/tacker.png | Bin .../{operations => }/optimization/congress.png | Bin .../{operations => }/optimization/rally.png | Bin .../{operations => }/optimization/vitrage.png | Bin .../{operations => }/optimization/watcher.png | Bin .../{lifecyclemanagement => }/packaging/loci.png | Bin .../packaging/puppet.png | Bin .../{lifecyclemanagement => }/packaging/rpm.png | Bin tests/test_diagram.py | 14 ++++++++++++++ 22 files changed, 14 insertions(+), 9 deletions(-) rename resources/aws/general/{Internet-gateway.png => internet-gateway.png} (100%) rename resources/openstack/{operations => }/billing/cloudkitty.png (100%) rename resources/openstack/{adjacentenablers => }/containerservices/kuryr.png (100%) rename resources/openstack/{lifecyclemanagement => }/deployment/ansible.png (100%) rename resources/openstack/{lifecyclemanagement => }/deployment/charms.png (100%) rename resources/openstack/{lifecyclemanagement => }/deployment/chef.png (100%) rename resources/openstack/{lifecyclemanagement => }/deployment/helm.png (100%) rename resources/openstack/{lifecyclemanagement => }/deployment/kolla.png (100%) rename resources/openstack/{lifecyclemanagement => }/deployment/tripleo.png (100%) rename resources/openstack/{operations => }/monitoring/monasca.png (100%) rename resources/openstack/{operations => }/monitoring/telemetry.png (100%) rename resources/openstack/{operations => }/multiregion/tricircle.png (100%) rename resources/openstack/{adjacentenablers => }/nfv/tacker.png (100%) rename resources/openstack/{operations => }/optimization/congress.png (100%) rename resources/openstack/{operations => }/optimization/rally.png (100%) rename resources/openstack/{operations => }/optimization/vitrage.png (100%) rename resources/openstack/{operations => }/optimization/watcher.png (100%) rename resources/openstack/{lifecyclemanagement => }/packaging/loci.png (100%) rename resources/openstack/{lifecyclemanagement => }/packaging/puppet.png (100%) rename resources/openstack/{lifecyclemanagement => }/packaging/rpm.png (100%) diff --git a/docs/nodes/openstack.md b/docs/nodes/openstack.md index 0d4c5059f..176c0f50a 100644 --- a/docs/nodes/openstack.md +++ b/docs/nodes/openstack.md @@ -5,9 +5,6 @@ title: OpenStack Node classes list of openstack provider. -## openstack.adjacentenablers - - ## openstack.apiproxies - **diagrams.openstack.apiproxies.EC2API** @@ -51,9 +48,6 @@ Node classes list of openstack provider. - **diagrams.openstack.frontend.Horizon** -## openstack.lifecyclemanagement - - ## openstack.monitoring - **diagrams.openstack.monitoring.Monasca** @@ -73,9 +67,6 @@ Node classes list of openstack provider. - **diagrams.openstack.nfv.Tacker** -## openstack.operations - - ## openstack.optimization - **diagrams.openstack.optimization.Congress** diff --git a/resources/aws/general/Internet-gateway.png b/resources/aws/general/internet-gateway.png similarity index 100% rename from resources/aws/general/Internet-gateway.png rename to resources/aws/general/internet-gateway.png diff --git a/resources/openstack/operations/billing/cloudkitty.png b/resources/openstack/billing/cloudkitty.png similarity index 100% rename from resources/openstack/operations/billing/cloudkitty.png rename to resources/openstack/billing/cloudkitty.png diff --git a/resources/openstack/adjacentenablers/containerservices/kuryr.png b/resources/openstack/containerservices/kuryr.png similarity index 100% rename from resources/openstack/adjacentenablers/containerservices/kuryr.png rename to resources/openstack/containerservices/kuryr.png diff --git a/resources/openstack/lifecyclemanagement/deployment/ansible.png b/resources/openstack/deployment/ansible.png similarity index 100% rename from resources/openstack/lifecyclemanagement/deployment/ansible.png rename to resources/openstack/deployment/ansible.png diff --git a/resources/openstack/lifecyclemanagement/deployment/charms.png b/resources/openstack/deployment/charms.png similarity index 100% rename from resources/openstack/lifecyclemanagement/deployment/charms.png rename to resources/openstack/deployment/charms.png diff --git a/resources/openstack/lifecyclemanagement/deployment/chef.png b/resources/openstack/deployment/chef.png similarity index 100% rename from resources/openstack/lifecyclemanagement/deployment/chef.png rename to resources/openstack/deployment/chef.png diff --git a/resources/openstack/lifecyclemanagement/deployment/helm.png b/resources/openstack/deployment/helm.png similarity index 100% rename from resources/openstack/lifecyclemanagement/deployment/helm.png rename to resources/openstack/deployment/helm.png diff --git a/resources/openstack/lifecyclemanagement/deployment/kolla.png b/resources/openstack/deployment/kolla.png similarity index 100% rename from resources/openstack/lifecyclemanagement/deployment/kolla.png rename to resources/openstack/deployment/kolla.png diff --git a/resources/openstack/lifecyclemanagement/deployment/tripleo.png b/resources/openstack/deployment/tripleo.png similarity index 100% rename from resources/openstack/lifecyclemanagement/deployment/tripleo.png rename to resources/openstack/deployment/tripleo.png diff --git a/resources/openstack/operations/monitoring/monasca.png b/resources/openstack/monitoring/monasca.png similarity index 100% rename from resources/openstack/operations/monitoring/monasca.png rename to resources/openstack/monitoring/monasca.png diff --git a/resources/openstack/operations/monitoring/telemetry.png b/resources/openstack/monitoring/telemetry.png similarity index 100% rename from resources/openstack/operations/monitoring/telemetry.png rename to resources/openstack/monitoring/telemetry.png diff --git a/resources/openstack/operations/multiregion/tricircle.png b/resources/openstack/multiregion/tricircle.png similarity index 100% rename from resources/openstack/operations/multiregion/tricircle.png rename to resources/openstack/multiregion/tricircle.png diff --git a/resources/openstack/adjacentenablers/nfv/tacker.png b/resources/openstack/nfv/tacker.png similarity index 100% rename from resources/openstack/adjacentenablers/nfv/tacker.png rename to resources/openstack/nfv/tacker.png diff --git a/resources/openstack/operations/optimization/congress.png b/resources/openstack/optimization/congress.png similarity index 100% rename from resources/openstack/operations/optimization/congress.png rename to resources/openstack/optimization/congress.png diff --git a/resources/openstack/operations/optimization/rally.png b/resources/openstack/optimization/rally.png similarity index 100% rename from resources/openstack/operations/optimization/rally.png rename to resources/openstack/optimization/rally.png diff --git a/resources/openstack/operations/optimization/vitrage.png b/resources/openstack/optimization/vitrage.png similarity index 100% rename from resources/openstack/operations/optimization/vitrage.png rename to resources/openstack/optimization/vitrage.png diff --git a/resources/openstack/operations/optimization/watcher.png b/resources/openstack/optimization/watcher.png similarity index 100% rename from resources/openstack/operations/optimization/watcher.png rename to resources/openstack/optimization/watcher.png diff --git a/resources/openstack/lifecyclemanagement/packaging/loci.png b/resources/openstack/packaging/loci.png similarity index 100% rename from resources/openstack/lifecyclemanagement/packaging/loci.png rename to resources/openstack/packaging/loci.png diff --git a/resources/openstack/lifecyclemanagement/packaging/puppet.png b/resources/openstack/packaging/puppet.png similarity index 100% rename from resources/openstack/lifecyclemanagement/packaging/puppet.png rename to resources/openstack/packaging/puppet.png diff --git a/resources/openstack/lifecyclemanagement/packaging/rpm.png b/resources/openstack/packaging/rpm.png similarity index 100% rename from resources/openstack/lifecyclemanagement/packaging/rpm.png rename to resources/openstack/packaging/rpm.png diff --git a/tests/test_diagram.py b/tests/test_diagram.py index ad8558c54..ae0bef52e 100644 --- a/tests/test_diagram.py +++ b/tests/test_diagram.py @@ -1,6 +1,7 @@ import os import shutil import unittest +import pathlib from diagrams import Cluster, Diagram, Edge, Node from diagrams import getcluster, getdiagram, setcluster, setdiagram @@ -283,3 +284,16 @@ def test_nodes_to_node_with_additional_attributes_directional(self): self.assertEqual( nodes << Edge(color="green", label="6.3") << Edge(color="pink", label="6.4") << node1, node1 ) + + +class ResourcesTest(unittest.TestCase): + def test_folder_depth(self): + """ + The code currently only handles resource folders up to a dir depth of 2 + i.e. resources/provider/module/icon.png, so check that this depth isn't + exceeded. + """ + resources_dir = pathlib.Path(__file__).parent.parent / 'resources' + max_depth = max(os.path.relpath(d, resources_dir).count(os.sep) + 1 + for d, _, _ in os.walk(resources_dir)) + self.assertLessEqual(max_depth, 2) From 8feeea748b44a36bd16efcedd7a8a6e673f968c4 Mon Sep 17 00:00:00 2001 From: lrjball <50599110+lrjball@users.noreply.github.com> Date: Mon, 12 Apr 2021 21:44:46 +0100 Subject: [PATCH 2/2] Update test_diagram.py updated doc string of test function --- tests/test_diagram.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_diagram.py b/tests/test_diagram.py index ae0bef52e..cc5567b0c 100644 --- a/tests/test_diagram.py +++ b/tests/test_diagram.py @@ -290,7 +290,7 @@ class ResourcesTest(unittest.TestCase): def test_folder_depth(self): """ The code currently only handles resource folders up to a dir depth of 2 - i.e. resources/provider/module/icon.png, so check that this depth isn't + i.e. resources///, so check that this depth isn't exceeded. """ resources_dir = pathlib.Path(__file__).parent.parent / 'resources'