forked from junoyoon/simpleupdatesiterepo
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from yandex-qatools/jpi_its
Jpi serve + integration tests for serve
- Loading branch information
Showing
12 changed files
with
214 additions
and
13 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
46 changes: 46 additions & 0 deletions
46
juseppe-cli/src/test/java/ru/lanwen/jenkins/juseppe/cli/ServeCommandTest.java
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,46 @@ | ||
package ru.lanwen.jenkins.juseppe.cli; | ||
|
||
|
||
import org.junit.ClassRule; | ||
import org.junit.Test; | ||
|
||
import static com.jayway.restassured.RestAssured.given; | ||
|
||
/** | ||
* @author lanwen (Merkushev Kirill) | ||
*/ | ||
public class ServeCommandTest { | ||
|
||
@ClassRule | ||
public static ServeRule srv = new ServeRule(); | ||
|
||
@Test(timeout = 10000) | ||
public void shouldFetchUpdateCenter() throws Exception { | ||
given() | ||
.baseUri(srv.uri().toString()) | ||
.log().all() | ||
.expect() | ||
.log().status() | ||
.get("update-center.json").then().assertThat().statusCode(200); | ||
} | ||
|
||
@Test(timeout = 10000) | ||
public void shouldFetchHpi() throws Exception { | ||
given() | ||
.baseUri(srv.uri().toString()) | ||
.log().all() | ||
.expect() | ||
.log().status() | ||
.get("clang-scanbuild-plugin.hpi").then().assertThat().statusCode(200); | ||
} | ||
|
||
@Test(timeout = 10000) | ||
public void shouldFetchJpi() throws Exception { | ||
given() | ||
.baseUri(srv.uri().toString()) | ||
.log().all() | ||
.expect() | ||
.log().status() | ||
.get("sample-pipeline-dsl-ext-plugin-0.1.0.jpi").then().assertThat().statusCode(200); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
juseppe-cli/src/test/java/ru/lanwen/jenkins/juseppe/cli/ServeRule.java
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,56 @@ | ||
package ru.lanwen.jenkins.juseppe.cli; | ||
|
||
import org.junit.rules.ExternalResource; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import ru.lanwen.jenkins.juseppe.props.Props; | ||
|
||
import java.io.IOException; | ||
import java.net.ServerSocket; | ||
import java.net.URI; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
import static com.google.common.io.Resources.getResource; | ||
import static java.lang.String.format; | ||
|
||
/** | ||
* @author lanwen (Merkushev Kirill) | ||
*/ | ||
public class ServeRule extends ExternalResource { | ||
private static final Logger LOG = LoggerFactory.getLogger(ServeRule.class); | ||
|
||
private CompletableFuture<Void> future; | ||
private int port; | ||
|
||
@Override | ||
protected void before() throws Throwable { | ||
port = findRandomOpenPortOnAllLocalInterfaces(); | ||
future = CompletableFuture.runAsync(() -> { | ||
try { | ||
new ServeCommand().unsafeRun(Props.populated() | ||
.withBaseurl(uri()) | ||
.withPluginsDir(getResource("serve/plugins").getFile()) | ||
.withCert(getResource("serve/cert/uc.crt").getFile()) | ||
.withKey(getResource("serve/cert/uc.key").getFile()) | ||
.withPort(port)); | ||
} catch (Exception e) { | ||
LOG.error("Can't start juseppe", e); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
protected void after() { | ||
future.cancel(true); | ||
} | ||
|
||
public URI uri() { | ||
return URI.create(format("http://localhost:%s", port)); | ||
} | ||
|
||
private Integer findRandomOpenPortOnAllLocalInterfaces() throws IOException { | ||
try (ServerSocket socket = new ServerSocket(0)) { | ||
return socket.getLocalPort(); | ||
} | ||
} | ||
} |
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,21 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIDZTCCAk2gAwIBAgIJAMWW8t2gQwMPMA0GCSqGSIb3DQEBCwUAMEkxCzAJBgNV | ||
BAYTAkVOMRYwFAYDVQQIDA1VcGRhdGUtQ2VudGVyMRAwDgYDVQQHDAdKdXNlcHBl | ||
MRAwDgYDVQQKDAdKdXNlcHBlMB4XDTE1MDYyOTE0NTY0N1oXDTE4MDUyMDE0NTY0 | ||
N1owSTELMAkGA1UEBhMCRU4xFjAUBgNVBAgMDVVwZGF0ZS1DZW50ZXIxEDAOBgNV | ||
BAcMB0p1c2VwcGUxEDAOBgNVBAoMB0p1c2VwcGUwggEiMA0GCSqGSIb3DQEBAQUA | ||
A4IBDwAwggEKAoIBAQCfX3nPkfyk+979zMhmfrlKa8K6t+USOcqcxcZ06ZbxRc/s | ||
RdXEvjMXL751zgjFrpUvSc5qpozvKo5Uqta/4Se96kagzQv7DEcJVCtY6F9R96Hs | ||
KpT/vl+Hjv6fuhap0JuOjtfClWQAe/i2goD16LUHS3LXKo1orDDUPtaKLHIRQIkO | ||
D+xhPpr0iEjKELjjbWs2wOYNMh9FASHZiGLsf63thXy8lL5t2bfF+j2XNqyy33Si | ||
8xs3+MLH5nhyrFGdLjd9V3QgbY1lqCbdkUoXCQjfIGom97gQnbw8/61gcAroNaAL | ||
CIhJ/cu0DdV+/ddmVI9bJNiQTT7Lu90YujL2b7YrAgMBAAGjUDBOMB0GA1UdDgQW | ||
BBRbIQ5EOViBEA0fGnsa4jNhznfbsDAfBgNVHSMEGDAWgBRbIQ5EOViBEA0fGnsa | ||
4jNhznfbsDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQADOO0+SojP | ||
Vvp80VG+dFe06JRdEt0SYFWUY/yEXzo5o2nKKloAnRWbcBJSokJi12xQaqBu8DDk | ||
KQA6fvOpdIXaqgC5RYCmlG4/2ZXr9W7vlfBeggGYH8iRbmWAsA2QJct8NtbN2OwM | ||
i3vTeQTK9qnz0tjdFeRhIiOq4ZEFXIYrHKUyrOrE/fLdWBKiL/bncIUZufBzOuT5 | ||
1l7H/eceb0nsP8JFHtWxAkaN/0mGgoY9g6Af2bEYNg94jjmQ2bugo4kVYq8REPSk | ||
0gbKukRX6FPYdpiAa7Rdjw22dfNZLTXahlVMRFmohmIGSBPvGOEKwWD4KicdFgvH | ||
9Qk/e5LNgzDH | ||
-----END CERTIFICATE----- |
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,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEowIBAAKCAQEAn195z5H8pPve/czIZn65SmvCurflEjnKnMXGdOmW8UXP7EXV | ||
xL4zFy++dc4Ixa6VL0nOaqaM7yqOVKrWv+EnvepGoM0L+wxHCVQrWOhfUfeh7CqU | ||
/75fh47+n7oWqdCbjo7XwpVkAHv4toKA9ei1B0ty1yqNaKww1D7WiixyEUCJDg/s | ||
YT6a9IhIyhC4421rNsDmDTIfRQEh2Yhi7H+t7YV8vJS+bdm3xfo9lzasst90ovMb | ||
N/jCx+Z4cqxRnS43fVd0IG2NZagm3ZFKFwkI3yBqJve4EJ28PP+tYHAK6DWgCwiI | ||
Sf3LtA3Vfv3XZlSPWyTYkE0+y7vdGLoy9m+2KwIDAQABAoIBAFFyxNj8/cX/Zs4E | ||
WyJufxl2ixVLqAkxece3F55mRprVl9ZjNkWPAqNF5itkeX01pM5/BLvilEIiWI0S | ||
ph933Qyk7yV8xTOu6Zrt5h1Q3G4ShTEh7fXpf/7SaHSO8Mgmc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bDgfrFbJOnk5QeiD9WJXUa8FtAER2WnsQnky7W+3cU | ||
sHQ1gC4gBBpH9ZDqP2wqK4L5WPzgreM3MzICMjwTzCsKUsg6kxKB | ||
-----END RSA PRIVATE KEY----- |
Binary file added
BIN
+58.7 KB
juseppe-cli/src/test/resources/serve/plugins/clang-scanbuild-plugin.hpi
Binary file not shown.
Binary file added
BIN
+246 KB
juseppe-cli/src/test/resources/serve/plugins/sample-pipeline-dsl-ext-plugin-0.1.0.jpi
Binary file not shown.
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