forked from devfile/integration-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_dot_devfile_cmd.py
88 lines (67 loc) · 2.93 KB
/
test_dot_devfile_cmd.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import tempfile
from utils.config import *
from utils.util import *
@pytest.mark.usefixtures("use_test_registry")
class TestDotDevfile:
CONTEXT = "test-context"
PORT_1 = "9090"
ENDPOINT_1 = "url-1"
HOST = "test.host.com"
tmp_project_name = None
@classmethod
def setup_class(cls):
# Runs once per class
cls.tmp_project_name = create_test_project()
@classmethod
def teardown_class(cls):
'''Runs at end of class'''
subprocess.run(["odo", "project", "delete", cls.tmp_project_name, "-f", "-w"])
def test_url_create_with_dot_devfile(self):
print('Test case : should successfully create url by using .devfile.yaml')
with tempfile.TemporaryDirectory() as tmp_workspace:
os.chdir(tmp_workspace)
# example devfile path
source_devfile_path = os.path.join(os.path.dirname(__file__),
'examples/source/devfiles/nodejs/devfile.yaml')
copy_and_create(source_devfile_path, "nodejs/project", tmp_workspace, self.CONTEXT)
os.chdir(self.CONTEXT)
# Todo: compatibility test with .devfile.yaml is working with odo version higher than v2.5.0.
# Uncomment the line when odo mirror site issue is fixed.
# subprocess.run(["mv", "devfile.yaml", ".devfile.yaml"])
subprocess.run(["odo", "url", "create", self.ENDPOINT_1, "--port", self.PORT_1,
"--host", self.HOST, "--secure", "--ingress"])
list_components_before_push = [
self.ENDPOINT_1,
"Not Pushed",
"true",
"ingress"
]
result = subprocess.run(["odo", "url", "list"],
capture_output=True, text=True, check=True)
assert match_all(result.stdout, list_components_before_push)
# Todo:
# list_components_after_push = [
# self.ENDPOINT_1,
# "Pushed",
# "true",
# "ingress"
# ]
#
# subprocess.run(["odo", "push"])
# result = subprocess.run(["odo", "url", "list"],
# capture_output=True, text=True, check=True)
#
# assert match_all(result.stdout, list_components_after_push)
# subprocess.run(["odo", "url", "delete", self.ENDPOINT_1, "-f"])
# result = subprocess.run(["odo", "url", "list"],
# capture_output=True, text=True, check=True)
#
# list_components_after_url_delete = [
# self.ENDPOINT_1,
# "Locally Deleted",
# "true",
# "ingress"
# ]
#
# assert match_all(result.stdout, list_components_after_url_delete)
# subprocess.run(["odo", "push"])