Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiobrz committed Jun 30, 2023
1 parent 1ce0e2f commit 37e82a8
Show file tree
Hide file tree
Showing 64 changed files with 197 additions and 138 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/kubernetes-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Intersmash - Simple build workflow

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
simple-build:
if: '! github.event.pull_request.draft'
runs-on: ubuntu-latest

steps:
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.7
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Maven
run: mvn -version ; mvn clean install -U -B -DskipTests
2 changes: 1 addition & 1 deletion testsuite/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@
</dependency>
</dependencies>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.jboss.intersmash.testsuite.k8s;

import org.junit.jupiter.api.Tag;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Mark test that runs against Kubernetes.
* Used per class.
*/
@Tag("ts.k8s")
@Retention(RetentionPolicy.RUNTIME)
@Target({ java.lang.annotation.ElementType.TYPE })
public @interface KubernetesTest {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.jboss.intersmash.testsuite.openshift;

import org.junit.jupiter.api.Tag;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* Mark test that runs against OpenShift.
* Used per class.
*/
@Tag("ts.openshift")
@Retention(RetentionPolicy.RUNTIME)
@Target({ java.lang.annotation.ElementType.TYPE })
public @interface OpenShiftTest {
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import java.nio.file.Paths;
import java.util.Arrays;

import org.jboss.intersmash.testsuite.k8s.KubernetesTest;
import org.jboss.intersmash.testsuite.k8s.NamespaceCreationCapable;
import org.jboss.intersmash.tools.application.openshift.HyperfoilOperatorApplication;
import org.jboss.intersmash.tools.application.operator.HyperfoilOperatorApplication;
import org.jboss.intersmash.tools.junit5.IntersmashExtension;
import org.jboss.intersmash.tools.k8s.KubernetesConfig;
import org.jboss.intersmash.tools.k8s.client.Kuberneteses;
Expand Down Expand Up @@ -51,6 +52,7 @@
import io.hyperfoil.v1alpha2.hyperfoilspec.Route;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@KubernetesTest
public class HyperfoilKubernetesOperatorProvisionerTest implements NamespaceCreationCapable {
private static final Logger logger = LoggerFactory.getLogger(HyperfoilKubernetesOperatorProvisionerTest.class);
private static final String NAME = "hyperfoil";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import java.util.Collections;
import java.util.List;

import org.jboss.intersmash.tools.application.openshift.ActiveMQOperatorApplication;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.operator.ActiveMQOperatorApplication;
import org.jboss.intersmash.tools.junit5.IntersmashExtension;
import org.jboss.intersmash.tools.provision.openshift.ActiveMQOpenShiftOperatorProvisioner;
import org.jboss.intersmash.tools.provision.openshift.operator.activemq.address.ActiveMQArtemisAddressBuilder;
Expand All @@ -43,7 +45,8 @@

@Slf4j
@CleanBeforeAll
public class ActiveMQOperatorProvisionerTest {
@OpenShiftTest
public class ActiveMQOpenShiftOperatorProvisionerTest implements ProjectCreationCapable {
private static final ActiveMQOpenShiftOperatorProvisioner activeMQOperatorProvisioner = initializeOperatorProvisioner();

private static ActiveMQOpenShiftOperatorProvisioner initializeOperatorProvisioner() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import java.nio.file.Paths;
import java.util.Arrays;

import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.openshift.HyperfoilOperatorApplication;
import org.jboss.intersmash.tools.application.operator.HyperfoilOperatorApplication;
import org.jboss.intersmash.tools.junit5.IntersmashExtension;
import org.jboss.intersmash.tools.provision.openshift.HyperfoilOpenShiftOperatorProvisioner;
import org.jboss.intersmash.tools.provision.openshift.operator.hyperfoil.client.runschema.RunStatisticsWrapper;
Expand All @@ -49,6 +50,7 @@
import io.hyperfoil.v1alpha2.HyperfoilBuilder;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@OpenShiftTest
public class HyperfoilOpenShiftOperatorProvisionerTest implements ProjectCreationCapable {
private static final Logger logger = LoggerFactory.getLogger(HyperfoilOpenShiftOperatorProvisionerTest.class);
private static final String NAME = "hyperfoil";
Expand Down Expand Up @@ -86,7 +88,7 @@ public static void createOperatorGroup() throws IOException {
public static void removeOperatorGroup() {
OpenShifts.adminBinary().execute("delete", "operatorgroup", "--all");
// there might be leftovers in case of failures
OpenShifts.admin().pods().withLabel("role", "agent").delete();
OpenShifts.admin().deletePods("role", "agent");
hyperfoilOperatorProvisioner.dismiss();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import java.util.Map;
import java.util.Objects;

import org.jboss.intersmash.tools.application.openshift.InfinispanOperatorApplication;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.operator.InfinispanOperatorApplication;
import org.jboss.intersmash.tools.junit5.IntersmashExtension;
import org.jboss.intersmash.tools.provision.openshift.InfinispanOpenShiftOperatorProvisioner;
import org.jboss.intersmash.tools.provision.openshift.operator.infinispan.cache.Cache;
Expand Down Expand Up @@ -58,7 +60,8 @@
*/
@Slf4j
@CleanBeforeAll
public class InfinispanOperatorProvisionerTest {
@OpenShiftTest
public class InfinispanOpenShiftOperatorProvisionerTest implements ProjectCreationCapable {
static final String TEST_SECRET_USERNAME = "developer";
static final String TEST_SECRET_PASSWORD = "developer";
static final String TEST_SECRET_NAME = "test-secret";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@

import java.io.IOException;

import org.jboss.intersmash.tools.application.openshift.KafkaOperatorApplication;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.operator.KafkaOperatorApplication;
import org.jboss.intersmash.tools.junit5.IntersmashExtension;
import org.jboss.intersmash.tools.provision.openshift.KafkaOpenShiftOperatorProvisioner;
import org.jboss.intersmash.tools.provision.openshift.operator.resources.OperatorGroup;
Expand All @@ -39,7 +41,8 @@
*/
@Slf4j
@CleanBeforeAll
public class KafkaOperatorProvisionerTest {
@OpenShiftTest
public class KafkaOpenShiftOperatorProvisionerTest implements ProjectCreationCapable {
private static KafkaOperatorApplication application = OpenShiftProvisionerTestBase.getKafkaApplication();
private static final KafkaOpenShiftOperatorProvisioner operatorProvisioner = initializeOperatorProvisioner();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.jboss.intersmash.tools.application.openshift.KeycloakOperatorApplication;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.operator.KeycloakOperatorApplication;
import org.jboss.intersmash.tools.junit5.IntersmashExtension;
import org.jboss.intersmash.tools.provision.openshift.KeycloakOpenShiftOperatorProvisioner;
import org.jboss.intersmash.tools.provision.openshift.operator.keycloak.backup.KeycloakBackup;
Expand Down Expand Up @@ -75,7 +77,8 @@
@Slf4j
@CleanBeforeAll
@Disabled("WIP - Disabled until global-test.properties is configured with the required property")
public class KeycloakOperatorProvisionerTest {
@OpenShiftTest
public class KeycloakOpenShiftOperatorProvisionerTest implements ProjectCreationCapable {
// Be aware that since we're using the static mock application, not all provisioner methods will work as expected!
private static final KeycloakOpenShiftOperatorProvisioner KEYCLOAK_OPERATOR_PROVISIONER = initializeOperatorProvisioner();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
import java.util.Map;
import java.util.Objects;

import org.jboss.intersmash.tools.application.openshift.KeycloakRealmImportOperatorApplication;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.operator.KeycloakRealmImportOperatorApplication;
import org.jboss.intersmash.tools.application.openshift.PostgreSQLImageOpenShiftApplication;
import org.jboss.intersmash.tools.junit5.IntersmashExtension;
import org.jboss.intersmash.tools.provision.openshift.KeycloakRealmImportOpenShiftOperatorProvisioner;
Expand Down Expand Up @@ -70,7 +72,8 @@
*/
@Slf4j
@CleanBeforeAll
public class KeycloakRealmImportOperatorProvisionerTest {
@OpenShiftTest
public class KeycloakRealmImportOpenShiftOperatorProvisionerTest implements ProjectCreationCapable {
private static KeycloakRealmImportOpenShiftOperatorProvisioner KEYCLOAK_OPERATOR_PROVISIONER;

private static final String POSTGRESQL_NAME = "postgresql";
Expand Down Expand Up @@ -102,8 +105,7 @@ public String getDbName() {
private static final PostgreSQLImageOpenShiftProvisioner POSTGRESQL_IMAGE_PROVISIONER = new PostgreSQLImageOpenShiftProvisioner(
pgSQLApplication);

private static KeycloakRealmImportOpenShiftOperatorProvisioner initializeOperatorProvisioner(final Keycloak keycloak,
final String appName) {
private static KeycloakRealmImportOpenShiftOperatorProvisioner initializeOperatorProvisioner(final Keycloak keycloak, final String appName) {
KeycloakRealmImportOpenShiftOperatorProvisioner operatorProvisioner = new KeycloakRealmImportOpenShiftOperatorProvisioner(
new KeycloakRealmImportOperatorApplication() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package org.jboss.intersmash.testsuite.provision.openshift;

import org.assertj.core.api.Assertions;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.openshift.MysqlImageOpenShiftApplication;
import org.jboss.intersmash.tools.provision.openshift.MysqlImageOpenShiftProvisioner;
import org.junit.jupiter.api.AfterAll;
Expand All @@ -29,7 +31,8 @@

@CleanBeforeAll
@Slf4j
public class MysqlImageTestCase {
@OpenShiftTest
public class MysqlImageTestCase implements ProjectCreationCapable {
private static final OpenShift openShift = OpenShifts.master();
private static final MysqlImageOpenShiftApplication application = OpenShiftProvisionerTestBase
.getMysqlOpenShiftApplication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,16 @@
import org.assertj.core.util.Strings;
import org.jboss.intersmash.deployments.IntersmashDelpoyableWildflyApplication;
import org.jboss.intersmash.deployments.IntersmashSharedDeployments;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.tools.IntersmashConfig;
import org.jboss.intersmash.tools.application.openshift.BootableJarOpenShiftApplication;
import org.jboss.intersmash.tools.application.openshift.KafkaOperatorApplication;
import org.jboss.intersmash.tools.application.operator.KafkaOperatorApplication;
import org.jboss.intersmash.tools.application.openshift.MysqlImageOpenShiftApplication;
import org.jboss.intersmash.tools.application.openshift.PostgreSQLImageOpenShiftApplication;
import org.jboss.intersmash.tools.application.openshift.WildflyImageOpenShiftApplication;
import org.jboss.intersmash.tools.application.openshift.input.BinarySource;
import org.jboss.intersmash.tools.application.openshift.input.BuildInput;
import org.jboss.intersmash.tools.application.openshift.input.BuildInputBuilder;
import org.jboss.intersmash.tools.application.input.BinarySource;
import org.jboss.intersmash.tools.application.input.BuildInput;
import org.jboss.intersmash.tools.application.input.BuildInputBuilder;
import org.jboss.intersmash.tools.util.IntersmashToolsProvisionersProperties;

import cz.xtf.builder.builders.SecretBuilder;
Expand All @@ -59,6 +60,7 @@
import lombok.extern.slf4j.Slf4j;

@Slf4j
@OpenShiftTest
public class OpenShiftProvisionerTestBase {
static final EnvVar TEST_ENV_VAR = new EnvVarBuilder().withName("test-evn-key").withValue("test-evn-value").build();
static final String TEST_SECRET_FOO = "foo";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package org.jboss.intersmash.testsuite.provision.openshift;

import org.assertj.core.api.Assertions;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.openshift.PostgreSQLImageOpenShiftApplication;
import org.jboss.intersmash.tools.provision.openshift.PostgreSQLImageOpenShiftProvisioner;
import org.junit.jupiter.api.AfterAll;
Expand All @@ -29,7 +31,8 @@

@CleanBeforeAll
@Slf4j
public class PostgreSQLImageTestCase {
@OpenShiftTest
public class PostgreSQLImageTestCase implements ProjectCreationCapable {
private static final OpenShift openShift = OpenShifts.master();
private static final PostgreSQLImageOpenShiftApplication application = OpenShiftProvisionerTestBase
.getPostgreSQLOpenShiftApplication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

import java.util.stream.Stream;

import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.provision.openshift.OpenShiftProvisioner;
import org.jboss.intersmash.tools.provision.openshift.WildflyBootableJarImageOpenShiftProvisioner;
import org.junit.jupiter.api.Assertions;
Expand All @@ -29,7 +31,8 @@
import io.fabric8.kubernetes.api.model.ConfigMapBuilder;

@CleanBeforeEach
public class ProvisionerCleanupTestCase {
@OpenShiftTest
public class ProvisionerCleanupTestCase implements ProjectCreationCapable {
protected static final OpenShift openShift = OpenShifts.master();

private static Stream<OpenShiftProvisioner> provisionerProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package org.jboss.intersmash.testsuite.provision.openshift;

import org.assertj.core.api.Assertions;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.openshift.BootableJarOpenShiftApplication;
import org.jboss.intersmash.tools.provision.openshift.BootableJarImageOpenShiftProvisioner;
import org.jboss.intersmash.tools.provision.openshift.WildflyBootableJarImageOpenShiftProvisioner;
Expand All @@ -29,7 +31,8 @@
import cz.xtf.junit5.annotations.CleanBeforeAll;

@CleanBeforeAll
public class WildflyBootableJarTestCase {
@OpenShiftTest
public class WildflyBootableJarTestCase implements ProjectCreationCapable {
private static final OpenShift openShift = OpenShifts.master();
private static final BootableJarOpenShiftApplication application = OpenShiftProvisionerTestBase
.getWildflyBootableJarOpenShiftApplication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.jboss.intersmash.testsuite.provision.openshift;

import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.openshift.helm.WildflyHelmChartOpenShiftApplication;
import org.jboss.intersmash.tools.provision.helm.HelmChartOpenShiftProvisioner;
import org.jboss.intersmash.tools.provision.helm.WildflyHelmChartOpenShiftProvisioner;
Expand All @@ -29,7 +31,8 @@
* programmatically
*/
@CleanBeforeAll
public class WildflyHelmChartProvisionerTest {
@OpenShiftTest
public class WildflyHelmChartProvisionerTest implements ProjectCreationCapable {

@Test
//@Disabled("No artifacts on a Maven repo which is reachable by the Pod")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

import org.assertj.core.api.Assertions;
import org.assertj.core.api.SoftAssertions;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.openshift.WildflyImageOpenShiftApplication;
import org.jboss.intersmash.tools.provision.openshift.WildflyImageOpenShiftProvisioner;
import org.junit.jupiter.api.AfterAll;
Expand All @@ -45,7 +47,8 @@
* inside the builder image.
*/
@CleanBeforeAll
public class WildflyImageProvisionerTestCase {
@OpenShiftTest
public class WildflyImageProvisionerTestCase implements ProjectCreationCapable {
private static final OpenShift openShift = OpenShifts.master();
private static final WildflyImageOpenShiftApplication application = OpenShiftProvisionerTestBase
.getWildflyOpenShiftImageApplication();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
package org.jboss.intersmash.testsuite.provision.openshift;

import org.assertj.core.api.Assertions;
import org.jboss.intersmash.testsuite.openshift.OpenShiftTest;
import org.jboss.intersmash.testsuite.openshift.ProjectCreationCapable;
import org.jboss.intersmash.tools.application.openshift.BootableJarOpenShiftApplication;
import org.jboss.intersmash.tools.provision.openshift.BootableJarImageOpenShiftProvisioner;
import org.jboss.intersmash.tools.provision.openshift.WildflyBootableJarImageOpenShiftProvisioner;
Expand All @@ -29,7 +31,8 @@
import cz.xtf.junit5.annotations.CleanBeforeAll;

@CleanBeforeAll
public class WildflyJavaxBootableJarTestCase {
@OpenShiftTest
public class WildflyJavaxBootableJarTestCase implements ProjectCreationCapable {
private static final OpenShift openShift = OpenShifts.master();
private static final BootableJarOpenShiftApplication application = OpenShiftProvisionerTestBase
.getWildflyBootableJarJavaxOpenShiftApplication();
Expand Down
Loading

0 comments on commit 37e82a8

Please sign in to comment.