Skip to content

Commit

Permalink
Let mockserver log, include docker logs in artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
theotherp committed Sep 23, 2023
1 parent e287a6d commit c7bd80f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/system-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,21 @@ jobs:
run: mvn --batch-mode test -pl org.nzbhydra.tests:system -DtrimStackTrace=false

- name: "Write docker-compose logs"
if: always()
run: |
cd docker
docker-compose logs --no-color > docker-compose.log
echo "Writing docker compose logs to files"
docker-compose logs --no-color radarr > docker-compose-radarr.log
docker-compose logs --no-color sonarr > docker-compose-sonarr.log
docker-compose logs --no-color mockserver > docker-compose-mockserver.log
docker-compose logs --no-color core > docker-compose-core.log
docker-compose logs --no-color v1Migration > docker-compose-v1Migration.log
echo "Found log files:"
find . -name "*.log"
cd ..
- name: "Truncate large log files"
if: always()
# If the logs are larger than 1MB there's probably something wrong
run: |
for d in ./**/*.log ; do (truncate --size=1M $d); done
Expand Down
6 changes: 3 additions & 3 deletions buildCore.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

setlocal

call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
rem call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x64

set path=c:\Programme\graalvm\graalvm-community-openjdk-21+35.1\bin\;%PATH%;c:\Programme\graalvm\graalvm-community-openjdk-21+35.1\bin\
set java_home=c:\Programme\graalvm\graalvm-community-openjdk-21+35.1
set path=c:\Programme\graalvm\graalvm-jdk-17.0.8+9.1\bin\;%PATH%;c:\Programme\graalvm\graalvm-jdk-17.0.8+9.1\bin\
set java_home=c:\Programme\graalvm\graalvm-jdk-17.0.8+9.1\
set HYDRA_NATIVE_BUILD=true
call mvn -pl org.nzbhydra:core -Pnative clean native:compile -DskipTests

Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ networks:
external: true
services:
mockserver:
image: ghcr.io/theotherp/mockserver:3.0.0
image: ghcr.io/theotherp/mockserver:3.1.0
container_name: mockserver
ports:
- "5080:5080"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public Asset uploadAsset(@RequestBody byte[] body) throws Exception {

@RequestMapping(value = "/changelog", method = RequestMethod.GET)
public List<ChangelogVersionEntry> changelog() throws Exception {
logger.info("Returning changelog");
return Arrays.asList(
new ChangelogVersionEntry("11.0.0", null, false, Arrays.asList(new ChangelogChangeEntry("note", "a note for beta release 11.0.0"), new ChangelogChangeEntry("note", "another note"), new ChangelogChangeEntry("note", "yet another note"))),
new ChangelogVersionEntry("4.0.0", null, true, Arrays.asList(new ChangelogChangeEntry("note", "a note"), new ChangelogChangeEntry("note", "another note"), new ChangelogChangeEntry("note", "yet another note"))),
Expand All @@ -97,11 +98,13 @@ public List<ChangelogVersionEntry> changelog() throws Exception {

@RequestMapping(value = "/theotherp/nzbhydra/master/news.json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String news() throws Exception {
logger.info("Returning news");
return new String(Files.readAllBytes(new File("news.json").toPath()));
}

@RequestMapping(value = "/theotherp/nzbhydra/master/blockedVersions.json", method = RequestMethod.GET)
public String blockedVersions() throws Exception {
logger.info("Returning blocked versions");
return "[{\"version\":\"3.2.1\",\"comment\":\"some comment\"}]";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,21 @@ public void init() {
@RequestMapping(value = "/nzb/{nzbId}", produces = MediaType.APPLICATION_XML_VALUE)
public ResponseEntity<String> nzbDownload(@PathVariable String nzbId) throws Exception {
if (nzbId.endsWith("91")) {
logger.info("Returning 91 - too many requests");
return ResponseEntity.status(HttpStatus.TOO_MANY_REQUESTS).build();
}
if (nzbId.endsWith("92")) {
logger.info("Returning 92 - not found");
return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
}
if (nzbId.endsWith("93")) {

logger.info("Returning 429 - request limit reached");
return ResponseEntity.status(429).body("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<error code=\"429\" description=\"Request limit reached\"/>");
}

logger.info("Returning NZB with ID {}", nzbId);
return ResponseEntity.ok("Would download NZB with ID" + nzbId);
}

Expand All @@ -98,7 +103,7 @@ public String nzbComments(@PathVariable String nzbId) throws Exception {

@RequestMapping(value = {"/api", "/dognzb/api"}, produces = MediaType.APPLICATION_XML_VALUE)
public ResponseEntity<? extends Object> api(NewznabParameters params, HttpServletRequest request) throws Exception {

logger.info("Received API request {}", params);
if (params.getT() == ActionAttribute.CAPS) {
//throw new RuntimeException("test");
return new ResponseEntity<Object>(NewznabMockBuilder.getCaps(), HttpStatus.OK);
Expand Down

0 comments on commit c7bd80f

Please sign in to comment.