Skip to content

Commit

Permalink
Use a global test resource for the Kubernetes server
Browse files Browse the repository at this point in the history
That means that the tests are not isolated from this POV but Marek was
saying this would be OK.
  • Loading branch information
gsmet committed Dec 23, 2024
1 parent d4a13f3 commit 27b405f
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.jboss.sbomer.service.feature.sbom.model.RequestEvent;
import org.jboss.sbomer.service.feature.sbom.service.RequestEventRepository;
import org.jboss.sbomer.service.test.utils.QuarkusTransactionalTest;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Order;
Expand All @@ -43,7 +42,6 @@
import lombok.extern.slf4j.Slf4j;

@QuarkusTransactionalTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.jboss.sbomer.service.feature.sbom.model.Sbom;
import org.jboss.sbomer.service.feature.sbom.model.SbomGenerationRequest;
import org.jboss.sbomer.service.feature.sbom.service.SbomService;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand All @@ -48,7 +47,6 @@
import io.restassured.path.json.JsonPath;

@QuarkusTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
class SBOMResourceRSQTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import org.jboss.sbomer.service.feature.sbom.service.SbomRepository;
import org.jboss.sbomer.service.feature.sbom.service.SbomService;
import org.jboss.sbomer.service.rest.QueryParameters;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import org.jboss.sbomer.service.feature.sbom.service.SbomService;
import org.jboss.sbomer.service.rest.QueryParameters;
import org.jboss.sbomer.service.test.utils.QuarkusTransactionalTest;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Test;

Expand All @@ -63,7 +62,6 @@

@ApplicationScoped
@QuarkusTransactionalTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
class SbomGenerationRequestRepositoryTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import org.jboss.sbomer.service.feature.sbom.service.SbomRepository;
import org.jboss.sbomer.service.rest.QueryParameters;
import org.jboss.sbomer.service.test.utils.QuarkusTransactionalTest;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Test;

Expand All @@ -56,7 +55,6 @@
import jakarta.validation.Validator;

@QuarkusTransactionalTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
class SbomRepositoryTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import org.hamcrest.CoreMatchers;
import org.jboss.sbomer.service.feature.sbom.service.SbomService;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand All @@ -15,7 +14,6 @@
import io.restassured.http.ContentType;

@QuarkusTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
class SyftImageResourceTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import static org.junit.Assert.assertSame;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.when;

Expand All @@ -44,7 +43,6 @@
import org.jboss.sbomer.service.feature.sbom.k8s.model.SbomGenerationStatus;
import org.jboss.sbomer.service.feature.sbom.k8s.reconciler.BuildController;
import org.jboss.sbomer.service.feature.sbom.k8s.resources.Labels;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
Expand Down Expand Up @@ -72,7 +70,6 @@
* Class responsible for testing reconciliation workflow for the generation phase.
*/
@QuarkusTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
class GenerationPhaseGenerationRequestReconcilerTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.jboss.sbomer.service.feature.sbom.features.umb.producer.model.Sbom.BomFormat;
import org.jboss.sbomer.service.feature.sbom.features.umb.producer.model.Sbom.OperationGenerationRequest;
import org.jboss.sbomer.service.feature.sbom.features.umb.producer.model.Sbom.PncBuildGenerationRequest;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Test;

Expand All @@ -48,7 +47,6 @@
import jakarta.inject.Inject;

@QuarkusTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
class GenerationFinishedMessageBodyTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import org.jboss.sbomer.service.feature.sbom.service.SbomGenerationRequestRepository;
import org.jboss.sbomer.service.test.PncWireMock;
import org.jboss.sbomer.service.test.utils.AmqpMessageHelper;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
Expand All @@ -71,7 +70,6 @@
import lombok.extern.slf4j.Slf4j;

@QuarkusTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
@WithTestResource(PncWireMock.class)
@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.hamcrest.CoreMatchers;
import org.hamcrest.Matchers;
import org.jboss.sbomer.service.feature.sbom.service.SbomService;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.provider.ValueSource;
Expand All @@ -39,7 +38,6 @@
* Ensures that we can handle errors properly.
*/
@QuarkusTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
class ErrorResourcesTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.jboss.sbomer.service.feature.sbom.service.AdvisoryService;
import org.jboss.sbomer.service.feature.sbom.service.SbomService;
import org.jboss.sbomer.service.pnc.PncClient;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand All @@ -70,7 +69,6 @@
import jakarta.inject.Inject;

@QuarkusTest
@WithSharedKubernetesTestServer
@TestProfile(TestUmbProfile.class)
class RestResourceTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.hamcrest.CoreMatchers;
import org.jboss.sbomer.service.feature.sbom.service.SbomService;
import org.jboss.sbomer.service.test.integ.rest.StatsResourceTest.CustomConfig;
import org.jboss.sbomer.service.test.utils.WithSharedKubernetesTestServer;
import org.jboss.sbomer.service.test.utils.umb.TestUmbProfile;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
Expand All @@ -34,7 +33,6 @@
import io.restassured.RestAssured;

@QuarkusTest
@WithSharedKubernetesTestServer
@TestProfile(CustomConfig.class)
class StatsResourceTest {
public static class CustomConfig extends TestUmbProfile {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package org.jboss.sbomer.service.test.utils;

import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.common.TestResourceScope;
import io.quarkus.test.common.WithTestResource;
import io.quarkus.test.kubernetes.client.KubernetesServerTestResource;

//@QuarkusTestResource(KubernetesServerTestResource.class)
@WithTestResource(value = KubernetesServerTestResource.class, scope = TestResourceScope.GLOBAL)
public class GlobalKubernetesServerResource {

}

This file was deleted.

This file was deleted.

0 comments on commit 27b405f

Please sign in to comment.