Skip to content

Checks and unit tests for empty jira payloads#330

Merged
isabelrios merged 5 commits intomasterfrom
irios-fix-jira-worklogs
Apr 8, 2026
Merged

Checks and unit tests for empty jira payloads#330
isabelrios merged 5 commits intomasterfrom
irios-fix-jira-worklogs

Conversation

@isabelrios
Copy link
Copy Markdown
Collaborator

To prevent silent failures caused by expired Jira API tokens, which return empty payloads with a
200 status, making builds appear successful while wiping the database, this PR adds:

  • A daily GitHub Action that runs unit tests and notifies Slack on failure
  • A credential check test that hits /rest/api/3/myself and fails explicitly if the token is expired
    or revoked
  • Guards in report_worklogs, jira_qa_requests, and jira_qa_requests_desktop that raise ValueError
    before touching the database if 0 issues or 0 worklogs are returned

@isabelrios isabelrios requested a review from AaronMT April 6, 2026 17:45
@isabelrios isabelrios marked this pull request as ready for review April 7, 2026 12:48
@isabelrios
Copy link
Copy Markdown
Collaborator Author

To consolidate and reduce duplication.. I am also removing the references to JIRA_ env variables since we will be using the ATLASSIAN_ ones which have the same value.

Copy link
Copy Markdown
Collaborator

@AaronMT AaronMT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks Isabel. One comment.

if 'database' not in sys.modules:
sys.modules['database'] = MagicMock()

ATLASSIAN_BASE_URL = f"https://{os.environ['ATLASSIAN_HOST']}/rest/api/3/"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs at import time, so if ATLASSIAN_HOST isn't set, the entire test module will fail to import with a KeyError, maybe rapping it in os.environ.get('ATLASSIAN_HOST', 'localhost') or moving it into setUp

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the host is not set.. it makes sense this all fails...it is always the same and set in secrets

@isabelrios isabelrios force-pushed the irios-fix-jira-worklogs branch from 07ff5c5 to f906a09 Compare April 8, 2026 10:46
@isabelrios isabelrios closed this Apr 8, 2026
@isabelrios isabelrios reopened this Apr 8, 2026
@isabelrios isabelrios merged commit 6bd3bd6 into master Apr 8, 2026
36 of 52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants