-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
112 additions
and
36 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# TYPE DATABASE USER ADDRESS METHOD | ||
local all all trust | ||
host all all all trust | ||
host replication all all trust |
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
31 changes: 21 additions & 10 deletions
31
test/e2e/src/test/java/smecalculus/bezmen/resilience/AbstractResilienceTest.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 |
---|---|---|
@@ -1,37 +1,48 @@ | ||
package smecalculus.bezmen.resilience; | ||
|
||
import static java.util.function.Function.identity; | ||
import static java.util.stream.Collectors.toMap; | ||
import static java.util.stream.Collectors.groupingBy; | ||
|
||
import com.github.dockerjava.api.DockerClient; | ||
import com.github.dockerjava.api.model.Container; | ||
import java.time.Duration; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.awaitility.Awaitility; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.test.context.ContextConfiguration; | ||
import org.springframework.test.context.junit.jupiter.SpringExtension; | ||
import smecalculus.bezmen.construction.StandBeans; | ||
import smecalculus.bezmen.messaging.BezmenClient; | ||
import smecalculus.bezmen.testing.Demiurge; | ||
|
||
@ExtendWith(SpringExtension.class) | ||
@ContextConfiguration(classes = StandBeans.class) | ||
public abstract class AbstractResilienceTest { | ||
|
||
protected static final String POSTGRES_PRIMARY = "postgres-primary"; | ||
protected static final String POSTGRES_SECONDARY = "postgres-secondary"; | ||
|
||
@Autowired | ||
private DockerClient dockerClient; | ||
|
||
@Autowired | ||
protected DockerClient dockerClient; | ||
protected BezmenClient bezmenClient; | ||
|
||
@Autowired | ||
protected Demiurge demiurge; | ||
|
||
protected Container postgresPrimary; | ||
protected Container postgresSecondary; | ||
protected Map<String, List<Container>> services; | ||
|
||
static { | ||
Awaitility.pollInSameThread(); | ||
Awaitility.setDefaultPollInterval(Duration.ofSeconds(1)); | ||
} | ||
|
||
@BeforeAll | ||
void abstractBeforeAll() { | ||
var containers = dockerClient.listContainersCmd().withShowAll(true).exec().stream() | ||
.collect(toMap(container -> container.getNames()[0], identity())); | ||
containers.values().forEach(demiurge::starts); | ||
postgresPrimary = containers.get("/bezmen-postgres-primary"); | ||
postgresSecondary = containers.get("/bezmen-postgres-secondary"); | ||
services = dockerClient.listContainersCmd().withShowAll(true).exec().stream() | ||
.collect(groupingBy(container -> container.getLabels().get("com.docker.compose.service"))); | ||
} | ||
} |
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