Skip to content

Commit

Permalink
sparser logging + fix container testing setup for gradle runs
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmoho committed Aug 23, 2022
1 parent ccfe645 commit ffa4e67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
id "java"
id "application"
Expand Down Expand Up @@ -49,6 +52,17 @@ test {
}
}

tasks.withType(Test) {
testLogging {
events TestLogEvent.FAILED
exceptionFormat TestExceptionFormat.FULL
showCauses true
showExceptions true
showStackTraces true
showStandardStreams false
}
}

repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
Expand Down
23 changes: 6 additions & 17 deletions src/test/java/edu/ucsd/sbrg/bigg/annotation/BiGGDBTest.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package edu.ucsd.sbrg.bigg.annotation;

import edu.ucsd.sbrg.db.BiGGDB;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;

Expand All @@ -13,22 +10,14 @@
@Testcontainers
public abstract class BiGGDBTest {


@BeforeEach
public void setup() {
BiGGDB.init(bigg.getHost(), bigg.getFirstMappedPort().toString(), "postgres", "postgres", "bigg");
}

@AfterEach
public void cleanUp() {
if (BiGGDB.inUse())
BiGGDB.close();
}

@Container
public GenericContainer bigg = new GenericContainer(DockerImageName.parse("preloaded_bigg:latest"))
static final GenericContainer bigg = new GenericContainer(DockerImageName.parse("preloaded_bigg:latest"))
.withExposedPorts(5432)
.withEnv("POSTGRES_PASSWORD", "postgres")
.withStartupTimeout(Duration.ofMinutes(5));

static {
bigg.start();
BiGGDB.init(bigg.getHost(), bigg.getFirstMappedPort().toString(), "postgres", "postgres", "bigg");
}

}

0 comments on commit ffa4e67

Please sign in to comment.