Skip to content

Commit

Permalink
Use code for procxy host as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Dohbedoh committed Aug 12, 2024
1 parent 6941ae3 commit c64b812
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private void addProxyInformation(PrintWriter out, ContentFilter filter) {
out.println("=== Proxy ===");
ProxyConfiguration proxy = Jenkins.get().getProxy();
if (proxy != null) {
out.println(" - Host: " + ContentFilter.filter(filter, proxy.getName()));
out.println(" - Host: `" + Markdown.escapeBacktick(ContentFilter.filter(filter, proxy.getName())) + "`");
out.println(" - Port: " + proxy.getPort());
out.println(" - No Proxy Hosts: ");
String noProxyHostsString = proxy.getNoProxyHost();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,17 @@ public class UpdateCenterTest {
public void testUpdateCenterProxyContent() {

List<String> noProxyHosts = Arrays.asList(".server.com", "*.example.com");
j.jenkins
.get()
.setProxy(new ProxyConfiguration(
"proxy.server.com",
1234,
"proxyUser",
"proxyPass",
String.join("\n", noProxyHosts),
"http://localhost:8080"));
j.jenkins.setProxy(new ProxyConfiguration(
"proxy.server.com",
1234,
"proxyUser",
"proxyPass",
String.join("\n", noProxyHosts),
"http://localhost:8080"));

String ucMdToString = SupportTestUtils.invokeComponentToString(
Objects.requireNonNull(ExtensionList.lookup(Component.class).get(UpdateCenter.class)));
assertThat(ucMdToString, containsString(" - Host: proxy.server.com"));
assertThat(ucMdToString, containsString(" - Host: `proxy.server.com`"));
assertThat(ucMdToString, containsString(" - Port: 1234"));
assertThat(ucMdToString, not(containsString("proxyUser")));
assertThat(ucMdToString, not(containsString("proxyPass")));
Expand Down

0 comments on commit c64b812

Please sign in to comment.