Skip to content

Commit

Permalink
tests for Spring and Docker Compose YAMLs
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Apr 20, 2024
1 parent d465649 commit e57bf95
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 41 deletions.
26 changes: 24 additions & 2 deletions src/test/java/com/amihaiemil/eoyaml/RtYamlInputTest.java
Expand Up @@ -2085,15 +2085,37 @@ public void readsFlowSequenceOneLine() throws IOException {
public void readsTypicalSpringApplicationProperties() throws IOException {
final YamlInput input = Yaml.createYamlInput(
new FileReader(
"src/test/resources/typicalSpringApplicationProperties.yml"
"src/test/resources/typical_examples/application.yml"
)
);
final YamlMapping read = input.readYamlMapping();
MatcherAssert.assertThat(
read.toString(),
Matchers.equalTo(
this.readTestResource(
"typicalSpringApplicationProperties_printed.yml"
"typical_examples/application.yml"
)
)
);
}

/**
* We can read a typical docker-compose.yml file.
* @throws IOException If something goes wrong.
*/
@Test
public void readsTypicalDockerComposeFile() throws IOException {
final YamlInput input = Yaml.createYamlInput(
new FileReader(
"src/test/resources/typical_examples/docker-compose.yml"
)
);
final YamlMapping read = input.readYamlMapping();
MatcherAssert.assertThat(
read.toString(),
Matchers.equalTo(
this.readTestResource(
"typical_examples/docker-compose.yml"
)
)
);
Expand Down
39 changes: 0 additions & 39 deletions src/test/resources/typicalSpringApplicationProperties.yml

This file was deleted.

@@ -1,3 +1,4 @@
# This is a typical application.yml file from Spring Framework.
logging:
level:
com:
Expand Down
56 changes: 56 additions & 0 deletions src/test/resources/typical_examples/docker-compose.yml
@@ -0,0 +1,56 @@
version: 3.8
name: docker-compose-dependencies
services:
mongo:
image: "mongo:5.0.0"
ports:
- "27017:27017"
command: "--bind_ip_all --replSet rs0"
healthcheck:
test: |
test $$(mongosh --quiet --eval "try { rs.initiate({ _id: 'rs0', members: [{ _id: 0, host: 'mongo' }] }).ok } catch (_) { rs.status().ok }") -eq 1
interval: 10s
start_period: 5s
kafka:
image: "redpandadata/redpanda:v23.2.12"
ports:
- "9092:9092"
spicedb:
image: "authzed/spicedb:v1.25.0"
ports:
- "50051:50051"
environment:
SPICEDB_DATASTORE_ENGINE: memory
command:
- serve-testing
- "--load-configs"
- /spicedb.yml
volumes:
- "./spicedb.yml:/spicedb.yml"
keycloak:
image: "quay.io/keycloak/keycloak:latest"
ports:
- "8080:8080"
environment:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
command:
- start-dev
- "--import-realm"
volumes:
- "./keycloak/test-realm.json:/opt/keycloak/data/import/realm.json"
jsreport:
image: "jsreport/jsreport:4.2.0"
ports:
- "5488:5488"
volumes:
- "../../root/jsreportapp/data:/app/data"
# SMTP Server for e-mailing.
devSmtp:
image: "jcalonso/mailhog:v1.0.1"
ports:
- "8025:8025"
- "1025:1025"
expose:
- 1025
- 8025

0 comments on commit e57bf95

Please sign in to comment.