Skip to content

Commit

Permalink
Remove old config
Browse files Browse the repository at this point in the history
  • Loading branch information
loicgreffier committed Aug 20, 2024
1 parent aded1f2 commit d620c9c
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import com.michelin.ns4kafka.model.RoleBinding.Verb;
import com.michelin.ns4kafka.service.executor.AccessControlEntryAsyncExecutor;
import com.michelin.ns4kafka.validation.TopicValidator;
import io.micronaut.context.annotation.Property;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
Expand All @@ -48,7 +47,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class AclIntegrationTest extends KafkaIntegrationTest {
@Inject
@Client("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.michelin.ns4kafka.model.Namespace;
import com.michelin.ns4kafka.model.RoleBinding;
import com.michelin.ns4kafka.validation.TopicValidator;
import io.micronaut.context.annotation.Property;
import io.micronaut.core.type.Argument;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
Expand All @@ -22,7 +21,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class ApiResourcesIntegrationTest extends KafkaIntegrationTest {
@Inject
@Client("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.michelin.ns4kafka.validation.ConnectValidator;
import com.michelin.ns4kafka.validation.TopicValidator;
import io.micronaut.context.ApplicationContext;
import io.micronaut.context.annotation.Property;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
Expand All @@ -54,7 +53,6 @@

@Slf4j
@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class ConnectorIntegrationTest extends KafkaConnectIntegrationTest {
@Inject
private ApplicationContext applicationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.michelin.ns4kafka.model.Topic;
import com.michelin.ns4kafka.model.Topic.TopicSpec;
import com.michelin.ns4kafka.validation.TopicValidator;
import io.micronaut.context.annotation.Property;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
Expand All @@ -42,7 +41,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class ExceptionHandlerIntegrationTest extends KafkaIntegrationTest {
@Inject
@Client("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;

import com.michelin.ns4kafka.integration.container.KafkaIntegrationTest;
import io.micronaut.context.annotation.Property;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
import io.micronaut.http.HttpStatus;
Expand All @@ -15,7 +14,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class LoginIntegrationTest extends KafkaIntegrationTest {
@Inject
@Client("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import com.michelin.ns4kafka.model.Status;
import com.michelin.ns4kafka.model.Topic;
import com.michelin.ns4kafka.validation.TopicValidator;
import io.micronaut.context.annotation.Property;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
Expand All @@ -30,7 +29,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class NamespaceIntegrationTest extends KafkaIntegrationTest {
@Inject
@Client("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import io.confluent.kafka.schemaregistry.client.rest.entities.requests.RegisterSchemaRequest;
import io.confluent.kafka.schemaregistry.client.rest.entities.requests.RegisterSchemaResponse;
import io.micronaut.context.ApplicationContext;
import io.micronaut.context.annotation.Property;
import io.micronaut.core.type.Argument;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
Expand All @@ -37,7 +36,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class SchemaIntegrationTest extends SchemaRegistryIntegrationTest {
@Inject
private ApplicationContext applicationContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import com.michelin.ns4kafka.model.Namespace.NamespaceSpec;
import com.michelin.ns4kafka.service.executor.AccessControlEntryAsyncExecutor;
import com.michelin.ns4kafka.validation.TopicValidator;
import io.micronaut.context.annotation.Property;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
Expand All @@ -37,7 +36,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class StreamIntegrationTest extends KafkaIntegrationTest {
@Inject
@Client("/")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import com.michelin.ns4kafka.model.Topic.TopicSpec;
import com.michelin.ns4kafka.service.executor.TopicAsyncExecutor;
import com.michelin.ns4kafka.validation.TopicValidator;
import io.micronaut.context.annotation.Property;
import io.micronaut.core.type.Argument;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
Expand Down Expand Up @@ -57,7 +56,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class TopicIntegrationTest extends KafkaIntegrationTest {
@Inject
@Client("/")
Expand Down Expand Up @@ -263,7 +261,7 @@ void shouldCreateTopic() throws InterruptedException, ExecutionException {

assertEquals("created", response.header("X-Ns4kafka-Result"));

topicAsyncExecutorList.forEach(TopicAsyncExecutor::run);
forceTopicSynchronization();

Admin kafkaClient = getAdminClient();

Expand Down Expand Up @@ -319,7 +317,7 @@ void shouldUpdateTopic() throws InterruptedException, ExecutionException {

assertEquals("created", response.header("X-Ns4kafka-Result"));

topicAsyncExecutorList.forEach(TopicAsyncExecutor::run);
forceTopicSynchronization();

response = ns4KafkaClient
.toBlocking()
Expand Down Expand Up @@ -354,8 +352,7 @@ void shouldUpdateTopic() throws InterruptedException, ExecutionException {

assertEquals("changed", response.header("X-Ns4kafka-Result"));

// Force Topic Sync
topicAsyncExecutorList.forEach(TopicAsyncExecutor::run);
forceTopicSynchronization();

Admin kafkaClient = getAdminClient();

Expand Down Expand Up @@ -496,7 +493,7 @@ void shouldUpdateTopicWithNoChange() {
}

@Test
void shouldDeleteRecords() {
void shouldDeleteRecords() throws InterruptedException {
Topic topicToDelete = Topic.builder()
.metadata(Metadata.builder()
.name("ns1-topicToDelete")
Expand All @@ -520,7 +517,7 @@ void shouldDeleteRecords() {

assertEquals("created", response.header("X-Ns4kafka-Result"));

topicAsyncExecutorList.forEach(TopicAsyncExecutor::run);
forceTopicSynchronization();

List<DeleteRecordsResponse> deleteRecordsResponse = ns4KafkaClient
.toBlocking()
Expand Down Expand Up @@ -565,7 +562,7 @@ void shouldDeleteRecords() {
}

@Test
void shouldDeleteRecordsOnCompactTopic() {
void shouldDeleteRecordsOnCompactTopic() throws InterruptedException {
Topic topicToDelete = Topic.builder()
.metadata(Metadata.builder()
.name("ns1-compactTopicToDelete")
Expand All @@ -590,7 +587,7 @@ void shouldDeleteRecordsOnCompactTopic() {

assertEquals("created", response.header("X-Ns4kafka-Result"));

topicAsyncExecutorList.forEach(TopicAsyncExecutor::run);
forceTopicSynchronization();

HttpClientResponseException exception = assertThrows(HttpClientResponseException.class,
() -> ns4KafkaClient
Expand All @@ -602,6 +599,13 @@ void shouldDeleteRecordsOnCompactTopic() {
assertEquals(HttpStatus.UNPROCESSABLE_ENTITY, exception.getStatus());
}

private void forceTopicSynchronization() throws InterruptedException {
topicAsyncExecutorList.forEach(TopicAsyncExecutor::run);

// Wait for topics to be updated in Kafka broker
Thread.sleep(2000);
}

@Data
@NoArgsConstructor
@AllArgsConstructor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.michelin.ns4kafka.model.quota.ResourceQuota;
import com.michelin.ns4kafka.service.executor.UserAsyncExecutor;
import com.michelin.ns4kafka.validation.TopicValidator;
import io.micronaut.context.annotation.Property;
import io.micronaut.http.HttpMethod;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.HttpResponse;
Expand All @@ -36,7 +35,6 @@
import org.junit.jupiter.api.Test;

@MicronautTest
@Property(name = "micronaut.security.gitlab.enabled", value = "false")
class UserIntegrationTest extends KafkaIntegrationTest {
@Inject
@Client("/")
Expand Down
7 changes: 5 additions & 2 deletions src/test/resources/application-test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
micronaut:
security:
gitlab:
enabled: false

kafka:
embedded:
enabled: false
bootstrap.servers: "localhost:9092" # Replaced by Testcontainers
sasl.mechanism: "PLAIN"
security.protocol: "SASL_PLAINTEXT"
Expand Down

0 comments on commit d620c9c

Please sign in to comment.