@@ -115,55 +115,39 @@ public void testPullRequestsPrepareToCreateWhenNoDockerfileFound() throws Except
115115 eq (gitHubContentToProcess ), anyList (), eq (gitForkBranch ),eq (rateLimiter ));
116116 }
117117
118- // @Test
119- // public void testPullRequestsPrepareSkipsSendingPRIfRepoOnboardedToRenovate() throws Exception {
120- // Map<String, Object> nsMap = ImmutableMap.of(
121- // Constants.IMG, "image",
122- // Constants.TAG, "tag",
123- // Constants.STORE,"store",
124- // Constants.SKIP_PR_CREATION,false,
125- // Constants.CHECK_FOR_RENOVATE, false);
126- //
127- //
128- // Namespace ns = new Namespace(nsMap);
129- // PullRequests pullRequests = new PullRequests();
130- // GitHubPullRequestSender pullRequestSender = mock(GitHubPullRequestSender.class);
131- // PagedSearchIterable<GHContent> contentsFoundWithImage = mock(PagedSearchIterable.class);
132- // GitForkBranch gitForkBranch = mock(GitForkBranch.class);
133- // DockerfileGitHubUtil dockerfileGitHubUtil = mock(DockerfileGitHubUtil.class);
134- // RenovateUtil renovateUtil = mock(RenovateUtil.class);
135- // RateLimiter rateLimiter = Mockito.spy(new RateLimiter());
136- // Multimap<String, GitHubContentToProcess> pathToDockerfilesInParentRepo = ArrayListMultimap.create();
137- // GitHubContentToProcess gitHubContentToProcess = mock(GitHubContentToProcess.class);
138- // pathToDockerfilesInParentRepo.put("repo1", gitHubContentToProcess);
139- // pathToDockerfilesInParentRepo.put("repo2", gitHubContentToProcess);
140- // pathToDockerfilesInParentRepo.put("repo3", gitHubContentToProcess);
141- // GHContent content = mock(GHContent.class);
142- // InputStream inputStream1 = new ByteArrayInputStream("{someKey:someValue}".getBytes());
143- // InputStream inputStream2 = new ByteArrayInputStream("{enabled:false}".getBytes());
144- // GHRepository ghRepository = mock(GHRepository.class);
145- //
146- // when(pullRequestSender.forkRepositoriesFoundAndGetPathToDockerfiles(contentsFoundWithImage, gitForkBranch)).thenReturn(pathToDockerfilesInParentRepo);
147- // when(gitHubContentToProcess.getParent()).thenReturn(ghRepository);
148- // //Fetch the content of the renovate.json file for the 3 repos.
149- // // The first one returns a file with regular json content.
150- // // The second one returns a file with the key 'enabled' set to 'false' to replicate a repo that has been onboarded to renovate but has it disabled
151- // // The third repo does not have the renovate.json file
152- //// when(ghRepository.getFileContent(anyString())).thenReturn(content).thenReturn(content).thenThrow(new FileNotFoundException());
153- //// when(ghRepository.getFullName()).thenReturn("org/repo");
154- //// when(content.read()).thenReturn(inputStream1).thenReturn(inputStream2);
155- //
156- // when(renovateUtil.isRenovateEnabledOnRepository(anyString())).thenReturn(true).thenReturn(false).thenReturn(false);
157- //
158- // pullRequests.prepareToCreate(ns, pullRequestSender, contentsFoundWithImage,
159- // gitForkBranch, dockerfileGitHubUtil, rateLimiter);
160- //
161- // //Verify that the DFIU PR is skipped for the first repo, but is sent to the other two repos
162- // verify(dockerfileGitHubUtil, times(2)).changeDockerfiles(eq(ns),
163- // eq(pathToDockerfilesInParentRepo),
164- // eq(gitHubContentToProcess), anyList(), eq(gitForkBranch),
165- // eq(rateLimiter));
166- // }
118+ // @Test
119+ // public void testPullRequestsPrepareSkipsSendingPRIfRepoOnboardedToRenovate() throws Exception {
120+ // Map<String, Object> nsMap = ImmutableMap.of(Constants.IMG,
121+ // "image", Constants.TAG,
122+ // "tag", Constants.STORE,
123+ // "store", Constants.SKIP_PR_CREATION,
124+ // false, Constants.CHECK_FOR_RENOVATE, true);
125+ // Namespace ns = new Namespace(nsMap);
126+ // PullRequests pullRequests = new PullRequests();
127+ // GitHubPullRequestSender pullRequestSender = mock(GitHubPullRequestSender.class);
128+ // PagedSearchIterable<GHContent> contentsFoundWithImage = mock(PagedSearchIterable.class);
129+ // GitForkBranch gitForkBranch = mock(GitForkBranch.class);
130+ // DockerfileGitHubUtil dockerfileGitHubUtil = mock(DockerfileGitHubUtil.class);
131+ // GithubAppCheck githubAppCheck = mock(GithubAppCheck.class);
132+ // RateLimiter rateLimiter = Mockito.spy(new RateLimiter());
133+ // Multimap<String, GitHubContentToProcess> pathToDockerfilesInParentRepo = ArrayListMultimap.create();
134+ // GitHubContentToProcess gitHubContentToProcess = mock(GitHubContentToProcess.class);
135+ // GHRepository ghRepository = mock(GHRepository.class);
136+ // pathToDockerfilesInParentRepo.put("repo1", gitHubContentToProcess);
137+
138+ // when(pullRequestSender.forkRepositoriesFoundAndGetPathToDockerfiles(contentsFoundWithImage, gitForkBranch)).thenReturn(pathToDockerfilesInParentRepo);
139+ // when(gitHubContentToProcess.getParent()).thenReturn(ghRepository);
140+ // when(ghRepository.getFullName()).thenReturn("repo");
141+ // when(githubAppCheck.isGithubAppEnabledOnRepository(anyString())).thenReturn(true);
142+
143+ // pullRequests.prepareToCreate(ns, pullRequestSender, contentsFoundWithImage,
144+ // gitForkBranch, dockerfileGitHubUtil, rateLimiter);
145+
146+ // verify(dockerfileGitHubUtil, times(0)).changeDockerfiles(eq(ns),
147+ // eq(pathToDockerfilesInParentRepo),
148+ // eq(gitHubContentToProcess), anyList(), eq(gitForkBranch),
149+ // eq(rateLimiter));
150+ // }
167151
168152 @ Test
169153 public void testisRenovateEnabledReturnsFalseIfRenovateConfigFileNotFound () throws IOException {
0 commit comments