Skip to content

Commit

Permalink
Adapt to the LPD project
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang Cao committed Jan 20, 2024
1 parent bb6686e commit 2889132
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 54 deletions.
46 changes: 5 additions & 41 deletions liferay/apps/create_test_fix_ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def add_test_fix_ticket(
):
print("Creating the Jira ticket...")

if project_key == "LPS":
if project_key == "LPD":
issue_dict = {
"project": {"key": "LPS"},
"project": {"key": "LPD"},
"summary": "Investigate failure in " + case_name,
"description": "*Error Message*\n\n{code:java}"
+ case_error
Expand All @@ -33,7 +33,8 @@ def add_test_fix_ticket(
+ case_result_id
+ "]",
"components": [{"name": component}],
"issuetype": {"name": "Task"},
"issuetype": {"name": "Testing"},
"customfield_10383": {"value": "Analysis"},
}
elif project_key == "LRQA":
issue_dict = {
Expand All @@ -51,37 +52,6 @@ def add_test_fix_ticket(
"components": [{"name": component}],
"issuetype": {"name": "Test Analysis"},
}
elif project_key == "LRAC":
issue_dict = {
"project": {"key": "LRAC"},
"summary": "Investigate failure in " + case_name,
"description": "*Error Message*\n\n{code:java}"
+ case_error
+ "{code}\n\n*Affect Tests*\n["
+ case_name
+ "|"
+ TESTRAY_INSTANCE
+ "/home/-/testray/case_results/"
+ case_result_id
+ "]",
"components": [{"name": component}],
"issuetype": {"name": "Task"},
}
elif project_key == "COMMERCE":
issue_dict = {
"project": {"key": "COMMERCE"},
"summary": "Investigate failure in " + case_name,
"description": "*Error Message*\n\n{code:java}"
+ case_error
+ "{code}\n\n*Affect Tests*\n["
+ case_name
+ "|"
+ TESTRAY_INSTANCE
+ "/home/-/testray/case_results/"
+ case_result_id
+ "]",
"issuetype": {"name": "Task"},
}

return jira_connection.create_issue(fields=issue_dict)

Expand Down Expand Up @@ -117,9 +87,6 @@ def get_case_result(auth, case_result_id):


def get_relevant_jira_component(case_result, jira_connection, project_key):
if project_key == "COMMERCE":
return

print("Matching the Jira component...")

jira_components = get_project_components(jira_connection, project_key)
Expand All @@ -131,15 +98,12 @@ def get_relevant_jira_component(case_result, jira_connection, project_key):
components = [n for n in jira_component_names if testray_component_name in n]

if len(components) == 0:
if project_key == "LPS":
if project_key == "LPD":
components = ["Testing > Portal"]

elif project_key == "LRQA":
components = ["Portal"]

elif project_key == "LRAC":
components = ["Test Infrastructure"]

return components[0]


Expand Down
6 changes: 1 addition & 5 deletions liferay/jira/jira_components_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,8 @@ def main():
"w",
)

sync_project_components(jira_connection, "COMMERCE")

sync_project_components(jira_connection, "LPS")
sync_project_components(jira_connection, "LPD")

sync_project_components(jira_connection, "LRQA")

sync_project_components(jira_connection, "LRAC")

print(f"\033[1;32mSuccessful\033[0m")
13 changes: 5 additions & 8 deletions script_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,13 @@ def compose(self) -> ComposeResult:
yield Submit("button-2")
with Form("nav-3"):
PROJECT_KEY = [
("LPS", "LPS"),
("LPD", "LPD"),
("LRQA", "LRQA"),
("LRAC", "LRAC"),
("COMMERCE", "COMMERCE"),
]

yield TextField("Enter the case result id: ", "case-result-id")
yield Label("Select the project key: ")
yield Select(PROJECT_KEY, id="project-key-1", value="LPS")
yield Select(PROJECT_KEY, id="project-key-1", value="LPD")
yield ToggleSwitch("assign-to-me-1")
yield TextField("Add label (Optional)", "add-label")
yield Submit("button-3")
Expand Down Expand Up @@ -158,10 +156,8 @@ def compose(self) -> ComposeResult:
yield Submit("button-6")
with Form("nav-7"):
PROJECT_KEY = [
("LPS", "LPS"),
("LPD", "LPD"),
("LRQA", "LRQA"),
("LRAC", "LRAC"),
("COMMERCE", "COMMERCE"),
]

PRODUCT_TEAM = [
Expand All @@ -171,6 +167,7 @@ def compose(self) -> ComposeResult:
ISSUE_TYPE = [
("Bug", "Bug"),
("Task", "Task"),
("Testing", "Testing"),
]

BUG_TYPE = [
Expand Down Expand Up @@ -284,7 +281,7 @@ def create_test_fix_ticket(self) -> None:
self.query_one("#assign-to-me-1").value = False
self.query_one("#case-result-id").value = ""
self.query_one("#add-label").value = ""
self.query_one("#project-key-1").value = "LPS"
self.query_one("#project-key-1").value = "LPD"
except (AssertionError, JIRAError, json.decoder.JSONDecodeError):
print(
f"\033[1;31mPlease check your credentials in credentials-ext.properties\033[0m"
Expand Down

0 comments on commit 2889132

Please sign in to comment.