Skip to content

Commit 2632b95

Browse files
committed
update health check test for 24a
1 parent 97d70aa commit 2632b95

File tree

4 files changed

+25
-46
lines changed

4 files changed

+25
-46
lines changed
Binary file not shown.
Binary file not shown.

healthcheck/test_mwasrefarch_healthcheck_newvpc.py

+7-17
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,32 @@
1010
from datetime import date
1111
import json
1212

13-
def main(keypairname, password, ipAddress, SSLCertificateARN, location_arg, platform_arg):
13+
def main(keypairname, password, ipAddress, location_arg, platform_arg):
1414
# Reference architectures in production.
1515
ref_arch_name = 'matlab-web-app-server-on-aws'
1616
parameters = [{'ParameterKey': 'KeyPairName', 'ParameterValue': keypairname},
1717
{'ParameterKey': 'AdminIPAddress', 'ParameterValue': ipAddress},
1818
{'ParameterKey': 'Password', 'ParameterValue': password},
1919
{'ParameterKey': 'ConfirmPassword', 'ParameterValue': password},
20-
{'ParameterKey': 'SSLCertificateARN', 'ParameterValue': SSLCertificateARN},
2120
{'ParameterKey': 'WorkerSystem', 'ParameterValue': platform_arg},
22-
{'ParameterKey': 'WorkerInstanceType', 'ParameterValue': 'm5.xlarge'},
2321
{'ParameterKey': 'UseSameIPForClient', 'ParameterValue': 'Yes'}]
2422

2523
# Find latest MATLAB release from Github page and get template url text
2624
res = requests.get(f"https://github.com/mathworks-ref-arch/{ref_arch_name}/blob/master/releases/")
2725

2826
# Deploy a stack for the latest two releases
2927
latest_releases = [re.findall("releases/(R\d{4}[ab]\\b)", res.text)[-1], re.findall("releases/(R\d{4}[ab]\\b)", res.text)[-2]]
30-
number_of_releases = 2
28+
number_of_releases = 1
3129
for i in range(number_of_releases):
3230
matlab_release = latest_releases[i]
3331
print("Testing Health Check Release: " + matlab_release + "\n")
3432
github_base_dir = "https://raw.githubusercontent.com/mathworks-ref-arch"
3533

36-
# Getting template url from .txt file
37-
# NOTE for code cleanup: Delete this branch after next release
38-
if matlab_release == "R2021b":
39-
template_url_path = f"{github_base_dir}/{ref_arch_name}/master/releases/{matlab_release}/templates.txt"
40-
file = urllib.request.urlopen(template_url_path)
41-
template_url = file.readline().decode("utf-8").rstrip()
42-
4334
# Getting template url from .json file
44-
else:
45-
template_url_path = f"{github_base_dir}/{ref_arch_name}/main/releases/{matlab_release}/templates.json"
46-
response = urllib.request.urlopen(template_url_path)
47-
template_json = json.loads(response.read())
48-
template_url = template_json["WebAppServer_new.yml"]
35+
template_url_path = f"{github_base_dir}/{ref_arch_name}/main/releases/{matlab_release}/templates.json"
36+
response = urllib.request.urlopen(template_url_path)
37+
template_json = json.loads(response.read())
38+
template_url = template_json["WebAppServer_new.yml"]
4939

5040
stack_name = "mwas-refarch-health-check-" + matlab_release + date.today().strftime('%m-%d-%Y') + str(random.randint(1,101))
5141
ct = datetime.datetime.now()
@@ -68,4 +58,4 @@ def main(keypairname, password, ipAddress, SSLCertificateARN, location_arg, plat
6858
print("\n\n")
6959

7060
if __name__ == '__main__':
71-
main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6])
61+
main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])

healthcheck/test_webappserver_refarch_existingvpc.py

+18-29
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from datetime import date
1515
import sys
1616

17-
def main(keypairname, password, ipAddress, SSLCertificateARN, location_arg, platform_arg):
17+
def main(keypairname, password, ipAddress, location_arg, platform_arg):
1818
# Reference architectures in production.
1919
# Deploy a stack for creating VPC with 2 subnets
2020
existing_template_url = "https://matlab-web-app-server-templates.s3.amazonaws.com/r2022a_refarch/VPCStack.yml"
@@ -32,46 +32,34 @@ def main(keypairname, password, ipAddress, SSLCertificateARN, location_arg, plat
3232
{'ParameterKey': 'AdminIPAddress', 'ParameterValue': ipAddress},
3333
{'ParameterKey': 'Password', 'ParameterValue': password},
3434
{'ParameterKey': 'ConfirmPassword', 'ParameterValue': password},
35-
{'ParameterKey': 'SSLCertificateARN', 'ParameterValue': SSLCertificateARN},
3635
{'ParameterKey': 'WorkerSystem', 'ParameterValue': platform_arg},
37-
{'ParameterKey': 'WorkerInstanceType', 'ParameterValue': 'm5.xlarge'},
3836
{'ParameterKey': 'UseSameIPForClient', 'ParameterValue': 'Yes'},
3937
{'ParameterKey': 'ExistingVPC', 'ParameterValue': vpc_id},
40-
{'ParameterKey': 'ExistingVPCAddress', 'ParameterValue': vpc_cidr},
4138
{'ParameterKey': 'ExistingSubnet1', 'ParameterValue': subnet1},
4239
{'ParameterKey': 'ExistingSubnet2', 'ParameterValue': subnet2},
43-
{'ParameterKey': 'ExistingSubnet3', 'ParameterValue': subnet3},
44-
{'ParameterKey': 'DeployLicenseServer', 'ParameterValue': 'Yes'},
45-
{'ParameterKey': 'ExistingLicenseServer', 'ParameterValue': '0.0.0.0'}]
40+
{'ParameterKey': 'DeployLicenseServer', 'ParameterValue': 'Yes'}]
4641

4742
# Find latest MATLAB release from Github page and get template url text
4843
res = requests.get(f"https://github.com/mathworks-ref-arch/{ref_arch_name}/blob/master/releases/")
4944

5045
# Deploy a stack for the latest two releases
5146
latest_releases = [re.findall("releases/(R\d{4}[ab]\\b)", res.text)[-1], re.findall("releases/(R\d{4}[ab]\\b)", res.text)[-2]]
52-
number_of_releases = 2
47+
number_of_releases = 1
5348
for i in range(number_of_releases):
5449
matlab_release = latest_releases[i]
5550
print("Testing Health Check Release: " + matlab_release + "\n")
5651
github_base_dir = "https://raw.githubusercontent.com/mathworks-ref-arch"
5752

58-
# Getting template url from .txt file
59-
# NOTE for code cleanup: Delete this branch after next release
60-
if matlab_release == "R2021b":
61-
template_url_path = f"{github_base_dir}/{ref_arch_name}/master/releases/{matlab_release}/templates.txt"
62-
file = urllib.request.urlopen(template_url_path)
63-
template_url = file.readline().decode("utf-8").rstrip()
64-
6553
# Getting template url from .json file
66-
else:
67-
template_url_path = f"{github_base_dir}/{ref_arch_name}/main/releases/{matlab_release}/templates.json"
68-
response = urllib.request.urlopen(template_url_path)
69-
template_json = json.loads(response.read())
70-
template_url = template_json["WebAppServer_existing.yml"]
54+
template_url_path = f"{github_base_dir}/{ref_arch_name}/main/releases/{matlab_release}/templates.json"
55+
response = urllib.request.urlopen(template_url_path)
56+
template_json = json.loads(response.read())
57+
template_url = template_json["WebAppServer_existing.yml"]
58+
7159
stack_name = "mwas-refarch-health-check-existing-vpc" + matlab_release + date.today().strftime('%m-%d-%Y') + str(random.randint(1,101))
7260
ct = datetime.datetime.now()
7361
print("Date time before deployment of stack:-", ct)
74-
62+
stack=None
7563
# Deploying the stack
7664
try:
7765
print("deploying the stack")
@@ -80,13 +68,14 @@ def main(keypairname, password, ipAddress, SSLCertificateARN, location_arg, plat
8068
except Exception as e:
8169
raise (e)
8270
finally:
83-
# Delete the deployment
84-
print("deleting the stack")
85-
deploy.delete_stack(stack)
86-
print("success deleting the stack")
87-
ct = datetime.datetime.now()
88-
print("Date time after deployment and deletion of stack:-", ct)
89-
print("\n\n")
71+
if stack:
72+
# Delete the deployment
73+
print("deleting the stack")
74+
deploy.delete_stack(stack)
75+
print("success deleting the stack")
76+
ct = datetime.datetime.now()
77+
print("Date time after deployment and deletion of stack:-", ct)
78+
print("\n\n")
9079

9180
if __name__ == '__main__':
92-
main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5], sys.argv[6])
81+
main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5])

0 commit comments

Comments
 (0)