Skip to content

Commit 81b1aed

Browse files
authored
[Manufacturing AI Suite][Metro AI Suite] Added Helm sanity tests for IRD apps and Metro Apps (open-edge-platform#1508)
1 parent 9b71bff commit 81b1aed

File tree

12 files changed

+1989
-301
lines changed

12 files changed

+1989
-301
lines changed

manufacturing-ai-suite/industrial-edge-insights-vision/tests/common_library/utils.py

Lines changed: 517 additions & 132 deletions
Large diffs are not rendered by default.

manufacturing-ai-suite/industrial-edge-insights-vision/tests/configs/config.json

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
"PDD005": {
2323
"app": "pdd",
2424
"pipeline": "pallet_defect_detection",
25-
"dlsps_log_param" : ["Starting WebRTC Stream for peer_id:pdd","fps","number-streams=1"]
25+
"dlsps_log_param": [
26+
"Starting WebRTC Stream for peer_id:pdd",
27+
"fps",
28+
"number-streams=1"
29+
]
2630
},
2731
"WELD001": {
2832
"app": "weld",
@@ -47,7 +51,11 @@
4751
"WELD005": {
4852
"app": "weld",
4953
"pipeline": "weld_porosity_classification",
50-
"dlsps_log_param" : ["Starting WebRTC Stream for peer_id:weld","fps","number-streams=1"]
54+
"dlsps_log_param": [
55+
"Starting WebRTC Stream for peer_id:weld",
56+
"fps",
57+
"number-streams=1"
58+
]
5159
},
5260
"PCB001": {
5361
"app": "pcb",
@@ -72,7 +80,11 @@
7280
"PCB005": {
7381
"app": "pcb",
7482
"pipeline": "pcb_anomaly_detection",
75-
"dlsps_log_param" : ["Starting WebRTC Stream for peer_id:anomaly","fps","number-streams=1"]
83+
"dlsps_log_param": [
84+
"Starting WebRTC Stream for peer_id:anomaly",
85+
"fps",
86+
"number-streams=1"
87+
]
7688
},
7789
"WSG001": {
7890
"app": "wsg",
@@ -97,6 +109,45 @@
97109
"WSG005": {
98110
"app": "wsg",
99111
"pipeline": "worker_safety_gear_detection",
100-
"dlsps_log_param" : ["Starting WebRTC Stream for peer_id:worker_safety","fps","number-streams=1"]
112+
"dlsps_log_param": [
113+
"Starting WebRTC Stream for peer_id:worker_safety",
114+
"fps",
115+
"number-streams=1"
116+
]
117+
},
118+
"PDDHELM001": {
119+
"app": "pdd",
120+
"pipeline": "pallet_defect_detection",
121+
"dlsps_log_param": [
122+
"fps",
123+
"number-streams=1"
124+
]
125+
},
126+
"WELDHELM001": {
127+
"app": "weld",
128+
"pipeline": "weld_porosity_classification",
129+
"dlsps_log_param": [
130+
"Starting WebRTC Stream for peer_id:weld",
131+
"fps",
132+
"number-streams=1"
133+
]
134+
},
135+
"PCBHELM001": {
136+
"app": "pcb",
137+
"pipeline": "pcb_anomaly_detection",
138+
"dlsps_log_param": [
139+
"Starting WebRTC Stream for peer_id:anomaly",
140+
"fps",
141+
"number-streams=1"
142+
]
143+
},
144+
"WSGHELM001": {
145+
"app": "wsg",
146+
"pipeline": "worker_safety_gear_detection",
147+
"dlsps_log_param": [
148+
"Starting WebRTC Stream for peer_id:worker_safety",
149+
"fps",
150+
"number-streams=1"
151+
]
101152
}
102153
}

manufacturing-ai-suite/industrial-edge-insights-vision/tests/functional_tests/apps.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,21 @@ def test_apps(self):
1616
test_case = os.environ['TEST_CASE']
1717
key, value = self.utils.json_reader(test_case, JSONPATH)
1818
self.utils.docker_compose_up(value)
19-
time.sleep(3)
19+
time.sleep(5)
2020

21-
self.utils.update_payload(value)
22-
self.utils.start_pipeline_and_check(value)
21+
self.utils.start_pipeline_and_check(value, "docker")
2322

2423
if not value.get("check_sample_start"):
25-
self.utils.list_pipelines(value)
24+
self.utils.list_pipelines(value, "docker")
2625

2726
if value.get("check_sample_status") or value.get("check_sample_stop") or (not value.get("check_sample_start") and not value.get("check_sample_list")):
28-
self.utils.get_pipeline_status(value)
27+
self.utils.get_pipeline_status(value, "docker")
2928

3029
if not value.get("check_sample_start") and not value.get("check_sample_list") and not value.get("check_sample_status") and not value.get("check_sample_stop"):
3130
self.utils.container_logs_checker_dlsps(test_case, value)
3231

3332
if value.get("check_sample_stop") or (not value.get("check_sample_start") and not value.get("check_sample_list") and not value.get("check_sample_status")):
34-
self.utils.stop_pipeline_and_check(value)
33+
self.utils.stop_pipeline_and_check(value, "docker")
3534

3635

3736
@classmethod
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import os
2+
import time
3+
import unittest
4+
import utils as module
5+
6+
JSONPATH = os.path.dirname(os.path.abspath(__file__)) + '/../configs/config.json'
7+
8+
class BaseTest(unittest.TestCase):
9+
@classmethod
10+
def setUpClass(cls):
11+
cls.path = os.path.dirname(os.path.abspath(__file__))
12+
cls.utils = module.utils()
13+
14+
class TestCaseManager(BaseTest):
15+
def test_apps(self):
16+
test_case = os.environ['TEST_CASE']
17+
key, value = self.utils.json_reader(test_case, JSONPATH)
18+
self.utils.update_values_helm(value)
19+
self.utils.helm_deploy(value)
20+
self.utils.start_pipeline_and_check(value, "helm")
21+
self.utils.list_pipelines(value, "helm")
22+
23+
self.utils.get_pipeline_status(value, "helm")
24+
self.utils.container_logs_checker_helm(test_case,value)
25+
time.sleep(5)
26+
self.utils.stop_pipeline_and_check(value, "helm")
27+
28+
29+
@classmethod
30+
def tearDownClass(cls):
31+
cls.utils.helm_uninstall()
32+
time.sleep(5)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
***Settings***
2+
Documentation This is main test case file.
3+
Library test_suite.py
4+
5+
***Keywords***
6+
7+
PddHelm_Test_case_001
8+
[Documentation] PDD - Verify the helm chart and helm install - Deploy the applcation steps on CPU and uninstall Helm
9+
${status} TC_001_PDDHELM
10+
Should Not Be Equal As Integers ${status} 1
11+
RETURN Run Keyword And Return Status ${status}
12+
13+
PcbHelm_Test_case_001
14+
[Documentation] PCB - Verify the helm chart and helm install - Deploy the applcation steps on CPU and uninstall Helm
15+
${status} TC_001_PCBHELM
16+
Should Not Be Equal As Integers ${status} 1
17+
RETURN Run Keyword And Return Status ${status}
18+
19+
WeldHelm_Test_case_001
20+
[Documentation] WELD - Verify the helm chart and helm install - Deploy the applcation steps on CPU and uninstall Helm
21+
${status} TC_001_WELDHELM
22+
Should Not Be Equal As Integers ${status} 1
23+
RETURN Run Keyword And Return Status ${status}
24+
25+
WsgHelm_Test_case_001
26+
[Documentation] WSG - Verify the helm chart and helm install - Deploy the applcation steps on CPU and uninstall Helm
27+
${status} TC_001_WSGHELM
28+
Should Not Be Equal As Integers ${status} 1
29+
RETURN Run Keyword And Return Status ${status}
30+
31+
32+
33+
***Test Cases***
34+
35+
#ALL the test cases related to PDD usecase
36+
37+
PDDHELM_TC_001
38+
[Documentation] PDD - Verify the helm chart and helm install - Deploy the applcation steps on CPU and uninstall Helm
39+
[Tags] app
40+
${Status} Run Keyword And Return Status PddHelm_Test_case_001
41+
Should Not Be Equal As Integers ${Status} 0
42+
43+
PCBHELM_TC_001
44+
[Documentation] PCB - Verify the helm chart and helm install - Deploy the applcation steps on CPU and uninstall Helm
45+
[Tags] app
46+
${Status} Run Keyword And Return Status PcbHelm_Test_case_001
47+
Should Not Be Equal As Integers ${Status} 0
48+
49+
WELDHELM_TC_001
50+
[Documentation] WELD - Verify the helm chart and helm install - Deploy the applcation steps on CPU and uninstall Helm
51+
[Tags] app
52+
${Status} Run Keyword And Return Status WeldHelm_Test_case_001
53+
Should Not Be Equal As Integers ${Status} 0
54+
55+
WSGHELM_TC_001
56+
[Documentation] WSG - Verify the helm chart and helm install - Deploy the applcation steps on CPU and uninstall Helm
57+
[Tags] app
58+
${Status} Run Keyword And Return Status WsgHelm_Test_case_001
59+
Should Not Be Equal As Integers ${Status} 0

manufacturing-ai-suite/industrial-edge-insights-vision/tests/robot_files/test_suite.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,27 @@ def TC_005_WSG(self):
111111
env["TEST_CASE"] = "WSG005"
112112
ret = subprocess.call("nosetests3 --nocapture -v ../functional_tests/apps.py:TestCaseManager.test_apps", shell=True, env=env)
113113
return ret
114+
115+
def TC_001_PDDHELM(self):
116+
env["TEST_CASE"] = "PDDHELM001"
117+
ret = subprocess.call("nosetests3 --nocapture -v ../functional_tests/apps_helm.py:TestCaseManager.test_apps", shell=True, env=env)
118+
return ret
119+
120+
def TC_001_PCBHELM(self):
121+
env["TEST_CASE"] = "PCBHELM001"
122+
ret = subprocess.call("nosetests3 --nocapture -v ../functional_tests/apps_helm.py:TestCaseManager.test_apps", shell=True, env=env)
123+
return ret
124+
125+
def TC_001_WELDHELM(self):
126+
env["TEST_CASE"] = "WELDHELM001"
127+
ret = subprocess.call("nosetests3 --nocapture -v ../functional_tests/apps_helm.py:TestCaseManager.test_apps", shell=True, env=env)
128+
return ret
129+
130+
def TC_001_WSGHELM(self):
131+
env["TEST_CASE"] = "WSGHELM001"
132+
ret = subprocess.call("nosetests3 --nocapture -v ../functional_tests/apps_helm.py:TestCaseManager.test_apps", shell=True, env=env)
133+
return ret
134+
114135

115136
if __name__ == '__main__':
116137
unittest.main()

0 commit comments

Comments
 (0)