Skip to content

Commit

Permalink
Merge pull request #42 from xiao201208/feature/add_stack_id
Browse files Browse the repository at this point in the history
add stack id info in html and json result
  • Loading branch information
xiao201208 authored May 17, 2024
2 parents 33f4778 + 55f6e62 commit d325599
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions iact3/report/generate_reports.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
import datetime
import json
import xml.etree.ElementTree as ET
import xml.dom.minidom as minidom
import logging
import os
Expand Down Expand Up @@ -84,6 +83,7 @@ async def generate_report(self):
status = stack.status
stack_name = stack.name
region = stack.region
stack_id = stack.id
css = "class=test-green" if status == 'CREATE_COMPLETE' else 'class=test-red'

with tag("tr"):
Expand All @@ -93,7 +93,9 @@ async def generate_report(self):
with tag("td", "class=text-left"):
text(region)
with tag("td", "class=text-left"):
text(stack_name)
ref_url = f"https://ros.console.aliyun.com/{region}/stacks/{stack_id}"
with tag("a", href=ref_url):
text(stack_name)
with tag("td", css):
text(str(status))
with tag("td", "class=text-left"):
Expand All @@ -107,6 +109,7 @@ async def generate_report(self):
'TestName': test_name,
'TestedRegion': region,
'StackName': stack_name,
'StackId': stack.id,
'TestResult': status,
'TestLog': clog,
'Result': 'Success' if success else 'Failed'
Expand Down Expand Up @@ -250,8 +253,6 @@ async def write_logs(self, stack: Stack, log_path: Path, log_formats: list):

log_output.write(xml_doc.toprettyxml(indent="\t"))



async with aiofiles.open(str(log_path)+'.txt', "a", encoding="utf-8") as log_output:
await log_output.write(
"------------------------------------------------------------------"
Expand Down
1 change: 1 addition & 0 deletions iact3/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ async def preview_stacks_result(self):
]
self.stacks += await asyncio.gather(*stack_tasks)


def criteria_matches(kwargs: dict, instance):
for k in kwargs:
if not hasattr(instance, k):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

setuptools.setup(
name="alibabacloud-ros-iact3",
version="0.1.7",
version="0.1.8",

description="Iact3 is a tool that tests Terraform and ROS(Resource Orchestration Service) templates.",
long_description=long_description,
Expand Down

0 comments on commit d325599

Please sign in to comment.