Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,20 @@ public class KafkaSubmodelServiceIdsOnlySmokeTest {
public void awaitAssignment() throws InterruptedException, SerializationException {
listener.awaitTopicAssignment();

assertNoAdditionalMessage();

FileRepository repository = new InMemoryFileRepository();
SubmodelBackend backend = new InMemorySubmodelBackend();
SubmodelServiceFactory smFactory = new CrudSubmodelServiceFactory(backend ,repository);
service = feature.decorate(smFactory).create(submodel);
}

@After
public void assertNoAdditionalMessage() throws InterruptedException {
SubmodelEvent evt = listener.next(1, TimeUnit.SECONDS);
Assert.assertNull(evt);
}

@Test
public void testToplevelSubmodelElementAdded() throws InterruptedException {
Assert.assertTrue(feature.isEnabled());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,21 @@ public class KafkaSubmodelServiceSubmodelElementsEventsIntegrationTest {
@Before
public void awaitAssignment() throws InterruptedException {
listener.awaitTopicAssignment();

skipAdditionalMessage();

FileRepository repository = new InMemoryFileRepository();
SubmodelBackend backend = new InMemorySubmodelBackend();
SubmodelServiceFactory smFactory = new CrudSubmodelServiceFactory(backend ,repository);
service = feature.decorate(smFactory).create(submodel);
}

@After
public void skipAdditionalMessage() throws InterruptedException {
Comment thread
geso02 marked this conversation as resolved.
while(listener.next(1, TimeUnit.MILLISECONDS) == null);

}

@Test
public void testToplevelSubmodelElementAdded() throws InterruptedException, SerializationException {
Assert.assertTrue(feature.isEnabled());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public class KafkaSubmodelServiceSubmodelEventsIntegrationTest {
public void awaitAssignment() throws InterruptedException {
listener.awaitTopicAssignment();
}

@After
public void assertGotTearDownMessage() throws InterruptedException {
SubmodelEvent evt = listener.next(1, TimeUnit.MINUTES);
Assert.assertNull(evt);
}

@Test
public void testSubmodelEvents() throws InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void onPartitionsAssigned(Map<TopicPartition, Long> assignments, Consumer
}

public void awaitTopicAssignment() throws InterruptedException {
if (!latch.await(5, TimeUnit.MINUTES)) {
if (!latch.await(10, TimeUnit.MINUTES)) {
throw new RuntimeException("Timeout occured while waiting for partition assignment. Is kafka running?");
}
}
Expand Down
32 changes: 25 additions & 7 deletions ci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.9"
services:

nginx-proxy:
Expand All @@ -16,18 +15,15 @@ services:

mongo:
image: mongo:5.0.10
# Provide mongo config
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: mongoAdmin
MONGO_INITDB_ROOT_PASSWORD: mongoPassword
# Set health checks to wait until mongo has started
healthcheck:
test: mongo
interval: 10s
start_period: 5s
retries: 5
# Maps tcp port to host
ports:
- 27017:27017
networks:
Expand Down Expand Up @@ -109,6 +105,9 @@ services:
volumes:
- ./keycloak/rules/rbac_rules-aas-discovery.json:/rbac/rbac_rules.json:ro
restart: always
depends_on:
keycloak-healthcheck:
condition: service_healthy
networks:
- basyx-java-server-sdk

Expand Down Expand Up @@ -153,6 +152,9 @@ services:
volumes:
- ./keycloak/rules/rbac_rules-aas-registry.json:/rbac/rbac_rules.json:ro
restart: always
depends_on:
keycloak-healthcheck:
condition: service_healthy
networks:
- basyx-java-server-sdk

Expand All @@ -174,6 +176,9 @@ services:
- ./keycloak/rules/rbac_rules-sm-registry.json:/rbac/rbac_rules.json:ro
ports:
- "8061:8080"
depends_on:
keycloak-healthcheck:
condition: service_healthy
restart: always
networks:
- basyx-java-server-sdk
Expand All @@ -187,6 +192,9 @@ services:
- ./rules/sm-repo-rbac_rules.json:/application/rbac_rules.json
- ./rules/sm-repo.properties:/application/application.properties
restart: always
depends_on:
keycloak-healthcheck:
condition: service_healthy
networks:
- basyx-java-server-sdk

Expand Down Expand Up @@ -253,13 +261,23 @@ services:
until curl -sf http://keycloak-nginx:8080/health/ready; do
sleep 5;
done;
echo 'Keycloak is ready!'"
echo 'Keycloak is ready!';
# Create a file that signals Keycloak is ready
touch /tmp/keycloak-ready;
# Keep container running after health check passes
tail -f /dev/null"
depends_on:
- keycloak
- keycloak-nginx
healthcheck:
test: ["CMD", "test", "-f", "/tmp/keycloak-ready"]
interval: 10s
timeout: 3s
retries: 20
start_period: 5s
networks:
- basyx-java-server-sdk

networks:
basyx-java-server-sdk:
name: basyx-java-server-sdk
driver: bridge
driver: bridge