瀏覽代碼

fix: removed over-nesting in resources file and added test (#498)

* Removed over-nesting in resources file and added test

* Update test_diagram.py

updated doc string of test function
pull/322/merge
lrjball 3 年之前
committed by GitHub
父節點
當前提交
e43c860732
沒有發現已知的金鑰在資料庫的簽署中 GPG Key ID: 4AEE18F83AFDEB23
共有 21 個文件被更改,包括 14 次插入9 次删除
  1. +0
    -9
      docs/nodes/openstack.md
  2. +0
    -0
      resources/openstack/billing/cloudkitty.png
  3. +0
    -0
      resources/openstack/containerservices/kuryr.png
  4. +0
    -0
      resources/openstack/deployment/ansible.png
  5. +0
    -0
      resources/openstack/deployment/charms.png
  6. +0
    -0
      resources/openstack/deployment/chef.png
  7. +0
    -0
      resources/openstack/deployment/helm.png
  8. +0
    -0
      resources/openstack/deployment/kolla.png
  9. +0
    -0
      resources/openstack/deployment/tripleo.png
  10. +0
    -0
      resources/openstack/monitoring/monasca.png
  11. +0
    -0
      resources/openstack/monitoring/telemetry.png
  12. +0
    -0
      resources/openstack/multiregion/tricircle.png
  13. +0
    -0
      resources/openstack/nfv/tacker.png
  14. +0
    -0
      resources/openstack/optimization/congress.png
  15. +0
    -0
      resources/openstack/optimization/rally.png
  16. +0
    -0
      resources/openstack/optimization/vitrage.png
  17. +0
    -0
      resources/openstack/optimization/watcher.png
  18. +0
    -0
      resources/openstack/packaging/loci.png
  19. +0
    -0
      resources/openstack/packaging/puppet.png
  20. +0
    -0
      resources/openstack/packaging/rpm.png
  21. +14
    -0
      tests/test_diagram.py

+ 0
- 9
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**


resources/openstack/operations/billing/cloudkitty.png → resources/openstack/billing/cloudkitty.png 查看文件


resources/openstack/adjacentenablers/containerservices/kuryr.png → resources/openstack/containerservices/kuryr.png 查看文件


resources/openstack/lifecyclemanagement/deployment/ansible.png → resources/openstack/deployment/ansible.png 查看文件


resources/openstack/lifecyclemanagement/deployment/charms.png → resources/openstack/deployment/charms.png 查看文件


resources/openstack/lifecyclemanagement/deployment/chef.png → resources/openstack/deployment/chef.png 查看文件


resources/openstack/lifecyclemanagement/deployment/helm.png → resources/openstack/deployment/helm.png 查看文件


resources/openstack/lifecyclemanagement/deployment/kolla.png → resources/openstack/deployment/kolla.png 查看文件


resources/openstack/lifecyclemanagement/deployment/tripleo.png → resources/openstack/deployment/tripleo.png 查看文件


resources/openstack/operations/monitoring/monasca.png → resources/openstack/monitoring/monasca.png 查看文件


resources/openstack/operations/monitoring/telemetry.png → resources/openstack/monitoring/telemetry.png 查看文件


resources/openstack/operations/multiregion/tricircle.png → resources/openstack/multiregion/tricircle.png 查看文件


resources/openstack/adjacentenablers/nfv/tacker.png → resources/openstack/nfv/tacker.png 查看文件


resources/openstack/operations/optimization/congress.png → resources/openstack/optimization/congress.png 查看文件


resources/openstack/operations/optimization/rally.png → resources/openstack/optimization/rally.png 查看文件


resources/openstack/operations/optimization/vitrage.png → resources/openstack/optimization/vitrage.png 查看文件


resources/openstack/operations/optimization/watcher.png → resources/openstack/optimization/watcher.png 查看文件


resources/openstack/lifecyclemanagement/packaging/loci.png → resources/openstack/packaging/loci.png 查看文件


resources/openstack/lifecyclemanagement/packaging/puppet.png → resources/openstack/packaging/puppet.png 查看文件


resources/openstack/lifecyclemanagement/packaging/rpm.png → resources/openstack/packaging/rpm.png 查看文件


+ 14
- 0
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 @@ class EdgeTest(unittest.TestCase):
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>/<type>/<image>, 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)

Loading…
取消
儲存