From 5ac73fe5bf91888964dc1ef12907a4000ef488e8 Mon Sep 17 00:00:00 2001 From: kAy Date: Tue, 31 Oct 2023 14:53:27 +1100 Subject: [PATCH] Removing FF skip-requested-reviewers (#2526) - Removing FF SKIP_REQUESTED_REVIEWERS --- src/config/feature-flags.ts | 1 - .../github-get-pull-request-reviews.test.ts | 26 ------------------- .../util/github-get-pull-request-reviews.ts | 6 ----- 3 files changed, 33 deletions(-) diff --git a/src/config/feature-flags.ts b/src/config/feature-flags.ts index d2a0db105b..4eb4c3d5c8 100644 --- a/src/config/feature-flags.ts +++ b/src/config/feature-flags.ts @@ -21,7 +21,6 @@ export enum BooleanFlags { USE_DYNAMODB_FOR_DEPLOYMENT_WEBHOOK = "use-dynamodb-for-deployment-webhook", USE_DYNAMODB_FOR_DEPLOYMENT_BACKFILL = "use-dynamodb-for-deployment-backfill", LOG_CURLV_OUTPUT = "log-curlv-output", - SKIP_REQUESTED_REVIEWERS = "skip-requested-reviewers", ENABLE_SUBSCRIPTION_DEFERRED_INSTALL = "enable-subscription-deferred-install", EARLY_EXIT_ON_VALIDATION_FAILED = "early-exit-on-validation-failed", ENABLE_CONNECTED_REPOS_VIEW="enable-connected-repos-view", diff --git a/src/transforms/util/github-get-pull-request-reviews.test.ts b/src/transforms/util/github-get-pull-request-reviews.test.ts index e087fd0333..e3b5d26a5c 100644 --- a/src/transforms/util/github-get-pull-request-reviews.test.ts +++ b/src/transforms/util/github-get-pull-request-reviews.test.ts @@ -4,8 +4,6 @@ import { getLogger } from "config/logger"; import { GitHubInstallationClient } from "~/src/github/client/github-installation-client"; import { getInstallationId } from "~/src/github/client/installation-id"; import pullRequest from "fixtures/api/pull-request.json"; -import { booleanFlag, BooleanFlags } from "config/feature-flags"; -import { when } from "jest-when"; jest.mock("config/feature-flags"); @@ -100,28 +98,4 @@ describe("getPullRequestReviews", () => { expect(result[1].user.login).toStrictEqual(pullRequest.user.login); expect(result[1].state).toStrictEqual("APPROVED"); }); - - it("should not fetch requested reviewers when skip FF is ON", async () => { - when(booleanFlag).calledWith(BooleanFlags.SKIP_REQUESTED_REVIEWERS, expect.anything()).mockResolvedValue(true); - - githubNock - .get(`/repos/batman/gotham-city-bus-pass/pulls/2/requested_reviewers`) - .times(0); - githubUserTokenNock(GITHUB_INSTALLATION_ID); - githubNock - .get(`/repos/batman/gotham-city-bus-pass/pulls/2/reviews`) - .reply(200, [{ - state: "APPROVED", - user: pullRequest.user - }]); - const client = new GitHubInstallationClient(getInstallationId(GITHUB_INSTALLATION_ID), gitHubCloudConfig, jiraHost, { trigger: "test" }, logger); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - const result = await getPullRequestReviews(jiraHost, client, MOCK_REPOSITORY, MOCK_PR, logger); - - expect(result).toHaveLength(1); - expect(result[0].user.login).toStrictEqual(pullRequest.user.login); - expect(result[0].state).toStrictEqual("APPROVED"); - }); - }); diff --git a/src/transforms/util/github-get-pull-request-reviews.ts b/src/transforms/util/github-get-pull-request-reviews.ts index 156903a5b1..b4e057207f 100644 --- a/src/transforms/util/github-get-pull-request-reviews.ts +++ b/src/transforms/util/github-get-pull-request-reviews.ts @@ -4,7 +4,6 @@ import { Octokit } from "@octokit/rest"; import Logger from "bunyan"; import { statsd } from "config/statsd"; import { metricPrReviewers } from "config/metric-names"; -import { booleanFlag, BooleanFlags } from "config/feature-flags"; export const getPullRequestReviews = async ( jiraHost: string, @@ -18,11 +17,6 @@ export const getPullRequestReviews = async ( const { number: pullRequestNumber, id: pullRequestId } = pullRequest; try { - if (await booleanFlag(BooleanFlags.SKIP_REQUESTED_REVIEWERS, jiraHost)) { - const response = await gitHubInstallationClient.getPullRequestReviews(repositoryOwner, repositoryName, pullRequestNumber); - return response.data; - } - const requestedReviewsResponse = await gitHubInstallationClient.getPullRequestRequestedReviews(repositoryOwner, repositoryName, pullRequestNumber); const requestedReviewsData = requestedReviewsResponse.data;