diff --git a/scripts/jira/manage_ticket.py b/scripts/jira/manage_ticket.py index 6fef16e2b2..06fca4202a 100644 --- a/scripts/jira/manage_ticket.py +++ b/scripts/jira/manage_ticket.py @@ -309,6 +309,16 @@ def command_close(args): ) +def command_get_status(args): + """Implement 'get_status' command.""" + server = jira.JIRA( + server=SERVER_URL, + token_auth=os.environ.get("JIRA_API_TOKEN"), + ) + ticket = server.issue(args.ticket_id) + print(f"{ticket.fields.status}") + + def main(): """The main program.""" parser = argparse.ArgumentParser( @@ -378,12 +388,22 @@ def main(): help='report but make no changes', ) + get_status_parser = subparsers.add_parser( + "get_status", + help="Find tickets status from ticket id", + ) + get_status_parser.add_argument( + "--ticket-id", dest="ticket_id", default=None, help="the ticket id", type=str + ) + args = parser.parse_args() if args.command == 'start': command_start(args) elif args.command == 'close': command_close(args) + elif args.command == "get_status": + command_get_status(args) else: parser.print_help() diff --git a/test/resources/common.resource b/test/resources/common.resource index b2a6763517..c2e3edad7d 100644 --- a/test/resources/common.resource +++ b/test/resources/common.resource @@ -3,10 +3,15 @@ Documentation Keywords common to many test suites Library OperatingSystem Library String +Library Process Library SSHLibrary Resource ../resources/kubeconfig.resource +*** Variables *** +${JIRA_API_TOKEN} ${EMPTY} + + *** Keywords *** Setup Suite [Documentation] Setup a namespace-less test suite by configuring Kubeconfig @@ -113,3 +118,15 @@ Create Random Temp Directory ${path}= Join Path ${root_path} ${rand} Create Directory ${path} RETURN ${path} + +Skip Test If Bug Is Open + [Documentation] Skip jira bug is not in Closed or Done state + [Arguments] ${ticket_id} + + IF '${JIRA_API_TOKEN}' == '${EMPTY}' + Log Variable 'JIRA_API_TOKEN' does not exist. Test is NOT skipped + ELSE + ${result}= Run Process ../scripts/jira/manage_ticket.sh get_status --ticket-id ${ticket_id} | tail -n1 + ... shell=True env:JIRA_API_TOKEN=${JIRA_API_TOKEN} + Skip If '${result.stdout}' == 'To Do' or '${result.stdout}' == 'In Progress' or '${result.stdout}' == 'Code Review' or '${result.stdout}' == 'Review' + END diff --git a/test/suites/standard1/networking-smoke.robot b/test/suites/standard1/networking-smoke.robot index e52546357a..743f0ae871 100644 --- a/test/suites/standard1/networking-smoke.robot +++ b/test/suites/standard1/networking-smoke.robot @@ -25,6 +25,8 @@ Router Smoke Test ... Expose Hello MicroShift Service Via Route ... Restart Router + Skip Test If Bug Is Open USHIFT-2349 + Wait Until Keyword Succeeds 10x 6s ... Access Hello Microshift Success ${HTTP_PORT}