Skip to content

Commit

Permalink
Downgrade Quarkus to 2.3.1.Final
Browse files Browse the repository at this point in the history
  • Loading branch information
gwenneg committed Jan 31, 2022
1 parent d655f9b commit 5239bfb
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 34 deletions.
2 changes: 2 additions & 0 deletions .rhcicd/clowdapp-engine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ objects:
value: ${PROCESSOR_EMAIL_NO_REPLY}
- name: QUARKUS_REST_CLIENT_RBAC_S2S_READ_TIMEOUT
value: ${RBAC_S2S_READ_TIMEOUT}
- name: RBAC_S2S_MP_REST_READTIMEOUT
value: ${RBAC_S2S_READ_TIMEOUT}
- name: RBAC_SERVICE_TO_SERVICE_APPLICATION
value: ${RBAC_SERVICE_TO_SERVICE_APP}
- name: RBAC_SERVICE_TO_SERVICE_SECRET_MAP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import io.quarkus.test.TestTransaction;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.providers.connectors.InMemorySink;
import io.smallrye.reactive.messaging.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.connectors.InMemorySink;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.redhat.cloud.notifications;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.connectors.InMemoryConnector;
import org.testcontainers.containers.PostgreSQLContainer;

import java.sql.SQLException;
Expand Down
27 changes: 27 additions & 0 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,33 @@
<generateGitPropertiesFile>true</generateGitPropertiesFile>
</configuration>
</plugin>
<!--
TODO quarkus-qute hack, remove it ASAP!
With Quarkus 2.3.1.Final, Qute is not able to find the templates resources located in the engine module when
the templates tests are run from the backend module. This issue does not exist with Quarkus > 2.6 so the
following configuration is only temporary and will be removed when the notifications split is over.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/templates</outputDirectory>
<resources>
<resource>
<directory>../engine/src/main/resources/templates</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@ public class NotificationsApp {

// we do need a event as parameter here, otherwise the init method won't get called.
void init(@Observes StartupEvent ev) {
disableRestClientContextualErrors();
// TODO Uncomment when Quarkus is bumped to 2.6.4.Final or newer.
//disableRestClientContextualErrors();

initAccessLogFilter();

LOG.info(readGitProperties());

logExternalServiceUrl("quarkus.rest-client.rbac-authentication.url");
logExternalServiceUrl("quarkus.rest-client.rbac-s2s.url");
logExternalServiceUrl("rbac-authentication/mp-rest/url");
logExternalServiceUrl("rbac-s2s/mp-rest/url");
}

private void disableRestClientContextualErrors() {
Expand Down
18 changes: 9 additions & 9 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ quarkus.log.category."com.redhat.cloud.notifications".level=INFO
rbac.enabled=true

# RBAC configuration used during user authentication. It is used when a public REST API is called.
#quarkus.rest-client.rbac-authentication.url=http://ci.foo.redhat.com:1337
quarkus.rest-client.rbac-authentication.url=${clowder.endpoints.rbac-service:https://ci.cloud.redhat.com}
quarkus.rest-client.rbac-authentication.connect-timeout=2000
quarkus.rest-client.rbac-authentication.read-timeout=2000
#rbac-authentication/mp-rest/url=http://ci.foo.redhat.com:1337
rbac-authentication/mp-rest/url=${clowder.endpoints.rbac-service:https://ci.cloud.redhat.com}
rbac-authentication/mp-rest/connectTimeout=2000
rbac-authentication/mp-rest/readTimeout=2000

# RBAC configuration used to retrieve email recipients. It is used when an email notification is sent.
#quarkus.rest-client.rbac-s2s.url=http://ci.foo.redhat.com:1337
quarkus.rest-client.rbac-s2s.url=${clowder.endpoints.rbac-service:https://ci.cloud.redhat.com}
quarkus.rest-client.rbac-s2s.connect-timeout=2000
quarkus.rest-client.rbac-s2s.read-timeout=120000
#rbac-s2s/mp-rest/url=http://ci.foo.redhat.com:1337
rbac-s2s/mp-rest/url=${clowder.endpoints.rbac-service:https://ci.cloud.redhat.com}
rbac-s2s/mp-rest/connectTimeout=2000
rbac-s2s/mp-rest/readTimeout=120000

# Duration rbac entries are kept in cache
quarkus.cache.caffeine.rbac-cache.expire-after-write=PT120s
Expand Down Expand Up @@ -131,4 +131,4 @@ quarkus.log.category."com.redhat.cloud.notifications.health.KafkaConsumedTotalCh
# Should messages about failed injections be delivered as new events (and thus emails to admins)
reinject.enabled=false

quarkus.rest-client.template-engine.url=${clowder.endpoints.notifications-backend-service:http://localhost:${quarkus.http.port}}
template-engine/mp-rest/url=${clowder.endpoints.notifications-backend-service:http://localhost:${quarkus.http.port}}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.redhat.cloud.notifications;

import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.connectors.InMemoryConnector;
import org.postgresql.ds.PGSimpleDataSource;
import org.testcontainers.containers.MockServerContainer;
import org.testcontainers.containers.PostgreSQLContainer;
Expand Down Expand Up @@ -120,7 +120,7 @@ void setupMockEngine(Map<String, String> props) {

configurator = new MockServerClientConfig(mockEngineServer.getContainerIpAddress(), mockEngineServer.getServerPort());

props.put("quarkus.rest-client.rbac-authentication.url", mockServerUrl);
props.put("quarkus.rest-client.rbac-s2s.url", mockServerUrl);
props.put("rbac-authentication/mp-rest/url", mockServerUrl);
props.put("rbac-s2s/mp-rest/url", mockServerUrl);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import io.quarkus.test.junit.mockito.InjectMock;
import io.quarkus.test.junit.mockito.InjectSpy;
import io.smallrye.mutiny.Uni;
import io.smallrye.reactive.messaging.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.kafka.api.OutgoingKafkaRecordMetadata;
import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector;
import org.apache.kafka.common.header.internals.RecordHeaders;
import org.eclipse.microprofile.reactive.messaging.Message;
import org.junit.jupiter.api.AfterEach;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.junit.mockito.InjectMock;
import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.connectors.InMemoryConnector;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import io.quarkus.test.junit.mockito.InjectSpy;
import io.restassured.http.Header;
import io.smallrye.mutiny.Uni;
import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.connectors.InMemoryConnector;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import io.quarkus.test.junit.QuarkusTest;
import io.smallrye.reactive.messaging.TracingMetadata;
import io.smallrye.reactive.messaging.ce.CloudEventMetadata;
import io.smallrye.reactive.messaging.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.connectors.InMemorySink;
import io.smallrye.reactive.messaging.kafka.api.KafkaMessageMetadata;
import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.providers.connectors.InMemorySink;
import io.vertx.core.json.JsonObject;
import org.apache.kafka.common.header.Headers;
import org.eclipse.microprofile.reactive.messaging.Message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import io.quarkus.test.junit.mockito.InjectMock;
import io.smallrye.mutiny.Multi;
import io.smallrye.mutiny.helpers.test.AssertSubscriber;
import io.smallrye.reactive.messaging.providers.connectors.InMemoryConnector;
import io.smallrye.reactive.messaging.connectors.InMemoryConnector;
import org.junit.jupiter.api.Test;

import javax.enterprise.inject.Any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.redhat.cloud.notifications.TestLifecycleManager;
import io.quarkus.cache.Cache;
import io.quarkus.cache.CacheName;
import io.quarkus.cache.runtime.caffeine.CaffeineCache;
import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.QuarkusTest;
import io.restassured.RestAssured;
Expand Down Expand Up @@ -45,7 +46,7 @@ void testEndpointRoles() {
.then()
.statusCode(401);

cache.invalidateAll().await().indefinitely();
clearRbacCache();

// Fetch endpoint without any Rbac details - errors cause 401
given()
Expand All @@ -55,7 +56,7 @@ void testEndpointRoles() {
.then()
.statusCode(401);

cache.invalidateAll().await().indefinitely();
clearRbacCache();

// Fetch endpoint with no access - Rbac succeed returns 403
mockServerConfig.addMockRbacAccess(identityHeaderValue, MockServerClientConfig.RbacAccess.NO_ACCESS);
Expand All @@ -67,7 +68,7 @@ void testEndpointRoles() {
.then()
.statusCode(403);

cache.invalidateAll().await().indefinitely();
clearRbacCache();

// Test bogus x-rh-identity header that fails Base64 decoding
given()
Expand All @@ -76,4 +77,12 @@ void testEndpointRoles() {
.then()
.statusCode(401);
}

private void clearRbacCache() {
/*
* TODO Replace with real programmatic API call when it will be available. For now we have to rely on this "hack".
* See https://github.com/quarkusio/quarkus/pull/8631
*/
((CaffeineCache) cache).invalidateAll();
}
}
10 changes: 4 additions & 6 deletions engine/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ quarkus.log.category."com.redhat.cloud.notifications".level=INFO
%test.quarkus.http.access-log.category=info

# RBAC configuration used to retrieve email recipients. It is used when an email notification is sent.
#quarkus.rest-client.rbac-s2s.url=http://ci.foo.redhat.com:1337
quarkus.rest-client.rbac-s2s.url=${clowder.endpoints.rbac-service:https://ci.cloud.redhat.com}
quarkus.rest-client.rbac-s2s.connect-timeout=2000
quarkus.rest-client.rbac-s2s.read-timeout=120000
#rbac-s2s/mp-rest/url=http://ci.foo.redhat.com:1337
rbac-s2s/mp-rest/url=${clowder.endpoints.rbac-service:https://ci.cloud.redhat.com}
rbac-s2s/mp-rest/connectTimeout=2000
rbac-s2s/mp-rest/readTimeout=120000

# Duration rbac entries are kept in cache
quarkus.cache.caffeine.rbac-cache.expire-after-write=PT120s
Expand Down Expand Up @@ -113,5 +113,3 @@ quarkus.log.category."com.redhat.cloud.notifications.health.KafkaConsumedTotalCh

# Should messages about failed injections be delivered as new events (and thus emails to admins)
reinject.enabled=false

quarkus.rest-client.template-engine.url=${clowder.endpoints.notifications-backend-service:http://localhost:${quarkus.http.port}}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.6.3.Final</quarkus.platform.version>
<quarkus.platform.version>2.3.1.Final</quarkus.platform.version>
</properties>

<dependencyManagement>
Expand Down

0 comments on commit 5239bfb

Please sign in to comment.