Skip to content

Commit

Permalink
Chore/minor improvements (#899)
Browse files Browse the repository at this point in the history
* test(cloud-stream): avoid port conflict with kafka plugin

Use 9095 instead of port 9092

* test(ui): resolve error message in test

* test(stomp): use correct assertEquals
  • Loading branch information
timonback authored Aug 4, 2024
1 parent fc8750a commit fdd1b5b
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ services:
kafka:
image: confluentinc/cp-kafka:latest
ports:
- "9092:9092" # plaintext - no authentication
- "9093:9093" # sasl
- "9095:9095" # plaintext - no authentication (port 9095 avoids conflict with kafka plugin)
volumes:
- ./broker_jaas.conf:/etc/kafka/secrets/broker_jaas.conf
environment:
KAFKA_NODE_ID: 1
CLUSTER_ID: 'MkU3OEVBNTcwNTJENDM2Qk=='
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092, INTERNAL://kafka:29092, SASL_PLAINTEXT://0.0.0.0:9093, SASL_INTERNAL://kafka:29093, CONTROLLER://kafka:29099
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092,INTERNAL://kafka:29092, SASL_PLAINTEXT://localhost:9093,SASL_INTERNAL://kafka:29093
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9095, INTERNAL://kafka:29092, SASL_PLAINTEXT://0.0.0.0:9093, SASL_INTERNAL://kafka:29093, CONTROLLER://kafka:29099
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9095,INTERNAL://kafka:29092, SASL_PLAINTEXT://localhost:9093,SASL_INTERNAL://kafka:29093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,INTERNAL:PLAINTEXT, SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_INTERNAL:SASL_PLAINTEXT, CONTROLLER:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_PROCESS_ROLES: 'controller,broker'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#########
# Spring configuration
spring.application.name=Springwolf example project - Cloud Stream
spring.kafka.bootstrap-servers=${BOOTSTRAP_SERVER:localhost:9092}
spring.kafka.bootstrap-servers=${BOOTSTRAP_SERVER:localhost:9095}


#########
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@EmbeddedKafka(
partitions = 1,
brokerProperties = {"listeners=PLAINTEXT://localhost:9092", "port=9092"})
brokerProperties = {"listeners=PLAINTEXT://localhost:9095", "port=9095"})
@DirtiesContext
public class ApiIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SpringContextIntegrationTest {
@SpringBootTest(classes = SpringwolfCloudstreamExampleApplication.class)
@EmbeddedKafka(
partitions = 1,
brokerProperties = {"listeners=PLAINTEXT://localhost:9092", "port=9092"})
brokerProperties = {"listeners=PLAINTEXT://localhost:9095", "port=9095"})
@Nested
@DirtiesContext
@TestPropertySource(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@EmbeddedKafka(
partitions = 1,
brokerProperties = {"listeners=PLAINTEXT://localhost:9092", "port=9092"})
brokerProperties = {"listeners=PLAINTEXT://localhost:9095", "port=9095"})
@DirtiesContext
class SpringwolfCloudstreamExampleApplicationIntegrationTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@ void publishWithSendToUser() throws ExecutionException, InterruptedException, Ti

// then
ExamplePayloadDto response = stompTestUtil.getMessage();
assertEquals(response, payload);
assertEquals(payload, response);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public R getMessage() throws InterruptedException {
}

public void send(String destination, Object payload) {
log.info("Sending message to {} with payload {}", destination, payload);
session.send(destination, payload);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ import { Example } from "../../../models/example.model";
import { JsonComponent } from "../../json/json.component";
import { render, screen } from "@testing-library/angular";
import { SchemaRangeComponent } from "../../schemas/range/schema-range.component";
import { MatDividerModule } from "@angular/material/divider";

describe("SchemaNewComponent", () => {
beforeEach(async () => {
const mockedSchemaRangeComponent = jest.fn();

await render(SchemaNewComponent, {
declarations: [SchemaNewComponent, SchemaRangeComponent, JsonComponent],
imports: [MatChipsModule, MarkdownModule.forRoot()],
imports: [MatChipsModule, MatDividerModule, MarkdownModule.forRoot()],
providers: [
{ provide: SchemaRangeComponent, useValue: mockedSchemaRangeComponent },
],
Expand Down

0 comments on commit fdd1b5b

Please sign in to comment.