mirror of
https://github.com/keycloak/keycloak.git
synced 2026-05-12 10:59:39 -05:00
fix: separating api server tests, and splitting the operator tests (#38118)
closes: #37853 Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
@@ -56,6 +56,9 @@ jobs:
|
||||
name: Test local
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
strategy:
|
||||
matrix:
|
||||
suite: [slow, fast]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -90,16 +93,23 @@ jobs:
|
||||
|
||||
- name: Test operator running locally
|
||||
run: |
|
||||
declare -A PARAMS
|
||||
PARAMS["slow"]="-Dkc.quarkus.tests.groups=slow"
|
||||
PARAMS["fast"]='-Dkc.quarkus.tests.groups=!slow'
|
||||
|
||||
./mvnw install -Poperator -pl :keycloak-operator -am \
|
||||
-Dquarkus.kubernetes.image-pull-policy=IfNotPresent \
|
||||
-Dkc.operator.keycloak.image=keycloak:${{ env.version_local }} \
|
||||
-Dtest.operator.custom.image=custom-keycloak:${{ env.version_local }} \
|
||||
-Dkc.operator.keycloak.image-pull-policy=Never
|
||||
-Dkc.operator.keycloak.image-pull-policy=Never ${PARAMS["${{ matrix.suite }}"]}
|
||||
|
||||
test-remote:
|
||||
name: Test remote
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build]
|
||||
strategy:
|
||||
matrix:
|
||||
suite: [slow, fast]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@@ -134,6 +144,10 @@ jobs:
|
||||
|
||||
- name: Test operator running in cluster
|
||||
run: |
|
||||
declare -A PARAMS
|
||||
PARAMS["slow"]="-Dkc.quarkus.tests.groups=slow"
|
||||
PARAMS["fast"]='-Dkc.quarkus.tests.groups=!slow'
|
||||
|
||||
eval $(minikube -p minikube docker-env)
|
||||
./mvnw install -Poperator -pl :keycloak-operator -am \
|
||||
-Dquarkus.container-image.build=true \
|
||||
@@ -141,7 +155,7 @@ jobs:
|
||||
-Dkc.operator.keycloak.image=keycloak:${{ env.version_remote }} \
|
||||
-Dquarkus.kubernetes.env.vars.kc-operator-keycloak-image-pull-policy=Never \
|
||||
-Dtest.operator.custom.image=custom-keycloak:${{ env.version_remote }} \
|
||||
--no-transfer-progress -Dtest.operator.deployment=remote
|
||||
--no-transfer-progress -Dtest.operator.deployment=remote ${PARAMS["${{ matrix.suite }}"]}
|
||||
|
||||
test-olm:
|
||||
name: Test OLM installation
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
<properties>
|
||||
<maven.compiler.parameters>true</maven.compiler.parameters>
|
||||
<kc.quarkus.tests.groups>!invalid</kc.quarkus.tests.groups>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<quarkus.container-image.group>keycloak</quarkus.container-image.group>
|
||||
@@ -116,6 +117,16 @@
|
||||
</dependency>
|
||||
|
||||
<!-- Test -->
|
||||
<dependency>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>kube-api-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>kube-api-test-client-inject</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.quarkus</groupId>
|
||||
<artifactId>quarkus-test-common</artifactId>
|
||||
@@ -261,6 +272,7 @@
|
||||
<!-- Used in KeycloakDeploymentTest#testPreconfiguredPodLabels -->
|
||||
<OPERATOR_TEST_LABEL_EXPRESSION>my-value</OPERATOR_TEST_LABEL_EXPRESSION>
|
||||
</systemPropertyVariables>
|
||||
<groups>${kc.quarkus.tests.groups}</groups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
+4
-3
@@ -15,9 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.keycloak.operator.testsuite.integration;
|
||||
package org.keycloak.operator.testsuite.apiserver;
|
||||
|
||||
import io.fabric8.junit.jupiter.api.KubernetesTest;
|
||||
import io.fabric8.kubeapitest.junit.EnableKubeAPIServer;
|
||||
import io.fabric8.kubernetes.api.model.HasMetadata;
|
||||
import io.fabric8.kubernetes.client.KubernetesClient;
|
||||
import io.fabric8.kubernetes.client.KubernetesClientException;
|
||||
@@ -34,13 +34,14 @@ import java.io.FileNotFoundException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.keycloak.operator.crds.v2alpha1.realmimport.KeycloakRealmImportBuilder;
|
||||
import org.keycloak.operator.testsuite.integration.BaseOperatorTest;
|
||||
import org.keycloak.operator.testsuite.utils.K8sUtils;
|
||||
import org.keycloak.operator.upgrade.UpdateStrategy;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
@KubernetesTest
|
||||
@EnableKubeAPIServer
|
||||
public class CRDTest {
|
||||
|
||||
static KubernetesClient client;
|
||||
+3
-1
@@ -96,6 +96,8 @@ import static org.keycloak.operator.testsuite.utils.K8sUtils.getResourceFromFile
|
||||
|
||||
public class BaseOperatorTest implements QuarkusTestAfterEachCallback {
|
||||
|
||||
public static final String SLOW = "slow";
|
||||
|
||||
public static final String QUARKUS_KUBERNETES_DEPLOYMENT_TARGET = "quarkus.kubernetes.deployment-target";
|
||||
public static final String OPERATOR_DEPLOYMENT_PROP = "test.operator.deployment";
|
||||
public static final String TARGET_KUBERNETES_GENERATED_YML_FOLDER = "target/kubernetes/";
|
||||
@@ -184,7 +186,7 @@ public class BaseOperatorTest implements QuarkusTestAfterEachCallback {
|
||||
.inNamespace(namespace).delete();
|
||||
}
|
||||
|
||||
static void createCRDs(KubernetesClient client) throws FileNotFoundException {
|
||||
public static void createCRDs(KubernetesClient client) throws FileNotFoundException {
|
||||
K8sUtils.set(client, new FileInputStream(TARGET_KUBERNETES_GENERATED_YML_FOLDER + "keycloaks.k8s.keycloak.org-v1.yml"));
|
||||
K8sUtils.set(client, new FileInputStream(TARGET_KUBERNETES_GENERATED_YML_FOLDER + "keycloakrealmimports.k8s.keycloak.org-v1.yml"));
|
||||
|
||||
|
||||
+2
@@ -34,6 +34,7 @@ import io.quarkus.test.junit.QuarkusTest;
|
||||
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
|
||||
import org.keycloak.operator.Config;
|
||||
@@ -75,6 +76,7 @@ import static org.keycloak.operator.testsuite.utils.K8sUtils.enableHttp;
|
||||
import static org.keycloak.operator.testsuite.utils.K8sUtils.getResourceFromFile;
|
||||
import static org.keycloak.operator.testsuite.utils.K8sUtils.waitForKeycloakToBeReady;
|
||||
|
||||
@Tag(BaseOperatorTest.SLOW)
|
||||
@QuarkusTest
|
||||
public class KeycloakDeploymentTest extends BaseOperatorTest {
|
||||
|
||||
|
||||
+3
@@ -25,6 +25,8 @@ import io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicy;
|
||||
import io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicyPeer;
|
||||
import io.fabric8.kubernetes.api.model.networking.v1.NetworkPolicyPeerBuilder;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.keycloak.operator.Constants;
|
||||
import org.keycloak.operator.Utils;
|
||||
@@ -38,6 +40,7 @@ import org.keycloak.operator.testsuite.utils.K8sUtils;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
@Tag(BaseOperatorTest.SLOW)
|
||||
@QuarkusTest
|
||||
public class KeycloakNetworkPolicyTest extends BaseOperatorTest {
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ import java.util.concurrent.TimeoutException;
|
||||
import io.fabric8.kubernetes.api.model.batch.v1.Job;
|
||||
import io.fabric8.kubernetes.api.model.batch.v1.JobStatus;
|
||||
import io.quarkus.test.junit.QuarkusTest;
|
||||
|
||||
import org.junit.jupiter.api.Tag;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
@@ -50,6 +52,7 @@ import static org.keycloak.operator.testsuite.utils.CRAssert.eventuallyRecreateU
|
||||
import static org.keycloak.operator.testsuite.utils.CRAssert.eventuallyRollingUpgradeStatus;
|
||||
import static org.keycloak.operator.testsuite.utils.K8sUtils.deployKeycloak;
|
||||
|
||||
@Tag(BaseOperatorTest.SLOW)
|
||||
@QuarkusTest
|
||||
public class UpgradeTest extends BaseOperatorTest {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user