8000 validate button can only work with fields that are defined before, no… · github-cloud/github-plugin@de4f7a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit de4f7a3

Browse files
committed
validate button can only work with fields that are defined before, not after
And if someone is testing a setting, cache can be only harmful, so might as well disable that. This also prevents garbage from accumulating
1 parent bbcdc95 commit de4f7a3

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/main/java/org/jenkinsci/plugins/github/config/GitHubServerConfig.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,11 @@ ACL.SYSTEM, fromUri(defaultIfBlank(apiUrl, GITHUB_URL)).build())
281281
@SuppressWarnings("unused")
282282
public FormValidation doVerifyCredentials(
283283
@QueryParameter String apiUrl,
284-
@QueryParameter String credentialsId,
285-
@QueryParameter Integer clientCacheSize) throws IOException {
284+
@QueryParameter String credentialsId) throws IOException {
286285

287286
GitHubServerConfig config = new GitHubServerConfig(credentialsId);
288287
config.setApiUrl(apiUrl);
289-
config.setClientCacheSize(clientCacheSize);
288+
config.setClientCacheSize(0);
290289
GitHub gitHub = new GitHubLoginFunction().apply(config);
291290

292291
try {

src/main/resources/org/jenkinsci/plugins/github/config/GitHubServerConfig/config.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ f.block() {
1919
title: _("Test connection"),
2020
progress: _("Testing..."),
2121
method: "verifyCredentials",
22-
with: "apiUrl,credentialsId,clientCacheSize"
22+
with: "apiUrl,credentialsId"
2323
)
2424
}
2525

src/test/java/org/jenkinsci/plugins/github/internal/GitHubClientCacheCleanupTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.junit.Rule;
77
import org.junit.Test;
88
import org.jvnet.hudson.test.JenkinsRule;
9+
import org.kohsuke.github.GitHub;
910

1011
import java.io.IOException;
1112
import java.nio.file.DirectoryStream;
@@ -101,7 +102,10 @@ private void it(String comment, int count) throws IOException {
101102
}
102103

103104
private void makeCachedRequestWithCredsId(String credsId) throws IOException {
104-
jRule.getInstance().getDescriptorByType(GitHubServerConfig.DescriptorImpl.class)
105-
.doVerifyCredentials(github.serverConfig().getApiUrl(), credsId, 1);
105+
GitHubServerConfig config = new GitHubServerConfig(credsId);
106+
config.setApiUrl(github.serverConfig().getApiUrl());
107+
config.setClientCacheSize(1);
108+
GitHub gitHub = new GitHubLoginFunction().apply(config);
109+
gitHub.getMyself();
106110
}
107111
}

0 commit comments

Comments
 (0)
0