Skip to content

Commit

Permalink
SWATCH-2980: Port export subscriptions to swatch contracts service
Browse files Browse the repository at this point in the history
The export of subscriptions was implemented as part of SWATCH-2021 and SWATCH-2023 (epic SWATCH-86).

Since the idea is to delete the subscription sync service, we need to also port this functionality to the swatch contracts.

Important changes:
- the Quarkus REST-Client does not support having multiple Content-Type, so I changed the export API to use instead of using application/json and application/csv, just use "application/octet-stream". 
- I had to disable/comment some tests because we need a Postgresql instance with all the migrations (the migration scripts from the monolith and the ones from the swatch-contracts). This needs to be addressed in a separated ticket which is already reported in SWATCH-2820
  • Loading branch information
Sgitario committed Oct 17, 2024
1 parent 8afe555 commit 92181bc
Show file tree
Hide file tree
Showing 29 changed files with 1,040 additions and 510 deletions.
6 changes: 1 addition & 5 deletions clients/export-client/export-api-spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ paths:
requestBody:
required: true
content:
application/json:
schema:
type: string
format: binary
application/csv:
application/octet-stream:
schema:
type: string
format: binary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package org.candlepin.subscriptions.capacity;

import org.candlepin.subscriptions.db.RhsmSubscriptionsDataSourceConfiguration;
import org.candlepin.subscriptions.export.ExportConfiguration;
import org.candlepin.subscriptions.resteasy.ResteasyConfiguration;
import org.springframework.boot.autoconfigure.AutoConfigurationExcludeFilter;
import org.springframework.boot.context.TypeExcludeFilter;
Expand All @@ -43,14 +42,11 @@
@Import({
ResteasyConfiguration.class,
RhsmSubscriptionsDataSourceConfiguration.class,
ExportConfiguration.class
})
@ComponentScan(
basePackages = {
"org.candlepin.subscriptions.capacity",
"org.candlepin.subscriptions.product",
"org.candlepin.subscriptions.export",
"org.candlepin.subscriptions.subscription.export",
},
// Prevent TestConfiguration annotated classes from being picked up by ComponentScan
excludeFilters = {
Expand Down
13 changes: 0 additions & 13 deletions src/main/resources/application-capacity-ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,2 @@
SUBSCRIPTION_EXPORT_TOPIC: ${clowder.kafka.topics."platform.export.requests".name:platform.export.requests}


rhsm-subscriptions:
export-service:
url: ${clowder.privateEndpoints.export-service-service.url:http://localhost:10000}
truststore: ${clowder.privateEndpoints.export-service-service.trust-store-path}
truststore-password: ${clowder.privateEndpoints.export-service-service.trust-store-password}
truststore-type: ${clowder.privateEndpoints.export-service-service.trust-store-type}
psk: ${SWATCH_EXPORT_PSK:placeholder}
subscription-sync-enabled: ${SUBSCRIPTION_SYNC_ENABLED:true}
export:
tasks:
topic: ${SUBSCRIPTION_EXPORT_TOPIC}
kafka-group-id: swatch-subscription-export
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import org.candlepin.subscriptions.db.model.Offering;
import org.candlepin.subscriptions.db.model.ServiceLevel;
import org.candlepin.subscriptions.db.model.Usage;
import org.candlepin.subscriptions.json.SubscriptionsExportJson;
import org.candlepin.subscriptions.json.InstancesExportJson;
import org.candlepin.subscriptions.rbac.RbacApiException;
import org.candlepin.subscriptions.rbac.RbacService;
import org.candlepin.subscriptions.task.TaskQueueProperties;
Expand Down Expand Up @@ -193,7 +193,7 @@ protected void verifyNoRequestsWereSentToExportServiceWithUploadData() {

protected void verifyRequestWasSentToExportServiceWithNoDataFound() {
verifyRequestWasSentToExportServiceWithUploadData(
request, toJson(new SubscriptionsExportJson().withData(new ArrayList<>())));
request, toJson(new InstancesExportJson().withData(new ArrayList<>())));
}

protected void updateOffering() {
Expand Down

This file was deleted.

Loading

0 comments on commit 92181bc

Please sign in to comment.