-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reduce calls to jira issue status (#2610)
* reduce calls to jira issue status
- Loading branch information
1 parent
9fc258d
commit 7248cb3
Showing
5 changed files
with
86 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { saveIssueStatusToRedis, getIssueStatusFromRedis } from "./jira-issue-check-redis-util"; | ||
import { numberFlag, NumberFlags } from "config/feature-flags"; | ||
import { when } from "jest-when"; | ||
|
||
jest.mock("config/feature-flags"); | ||
|
||
describe("Redis for jira issue status", () => { | ||
const TIMEOUT = 10_000; | ||
let issueKey: string; | ||
beforeEach(async () => { | ||
when(numberFlag).calledWith(NumberFlags.SKIP_PROCESS_QUEUE_IF_ISSUE_NOT_FOUND_TIMEOUT, expect.anything(), expect.anything()) | ||
.mockResolvedValue(TIMEOUT); | ||
issueKey = "ABC-" + Math.floor(Math.random() * 10000); | ||
}); | ||
it("should save and successfully retried last status (exist)", async () => { | ||
await saveIssueStatusToRedis(jiraHost, issueKey, "exist"); | ||
const status = await getIssueStatusFromRedis(jiraHost, issueKey); | ||
expect(status).toEqual("exist"); | ||
}); | ||
it("should save and successfully retried last status (not-exists)", async () => { | ||
await saveIssueStatusToRedis(jiraHost, issueKey, "not_exist"); | ||
const status = await getIssueStatusFromRedis(jiraHost, issueKey); | ||
expect(status).toEqual("not_exist"); | ||
}); | ||
it("should return null on not found status", async () => { | ||
const status = await getIssueStatusFromRedis(jiraHost, issueKey); | ||
expect(status).toBeNull(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters