Skip to content

Commit

Permalink
ci: OpenShift 4 pipeline running on OSPO OSCI
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa authored Apr 11, 2024
1 parent 979fc3b commit 0299873
Show file tree
Hide file tree
Showing 18 changed files with 107 additions and 29 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/e2e-osci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#
# Copyright (C) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: E2E osci.io Tests

on:
workflow_dispatch:
schedule:
- cron: '0 4 * * *' # Every day at 4am

concurrency:
group: single-instance-for-persistent-cluster
cancel-in-progress: true

env:
IT_MODULE: kubernetes-itests
MAVEN_ARGS: -B -C -V -ntp -Dhttp.keepAlive=false -e
FAILSAFE_TEST_GROUPS: OSCI

jobs:
e2e:
name: E2E OpenShift 4
runs-on: ubuntu-latest
if: github.repository == 'fabric8io/kubernetes-client'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Java 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Install oc
uses: redhat-actions/oc-installer@v1
- name: Login to OpenShift
run: |
oc login --server=${{ secrets.OSCI_SERVER }} --token=${{ secrets.OSCI_TOKEN }}
- name: Run Integration Tests
run: |
./mvnw ${MAVEN_ARGS} -Pitests -pl $IT_MODULE -Dgroups=$FAILSAFE_TEST_GROUPS verify
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.openshift.api.model.Project;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(Project.class)
class AdaptIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.fabric8.openshift.api.model.BuildSourceBuilder;
import io.fabric8.openshift.client.OpenShiftClient;
import org.assertj.core.api.InstanceOfAssertFactories;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.util.Objects;
Expand All @@ -34,6 +35,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(BuildConfig.class)
@LoadKubernetesManifests("/buildconfig-it.yml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.fabric8.openshift.api.model.BuildRequest;
import io.fabric8.openshift.api.model.BuildRequestBuilder;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.util.Objects;
Expand All @@ -38,6 +39,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(BuildConfig.class)
@LoadKubernetesManifests("/build-config-watch.yml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.commons.compress.archivers.tar.TarArchiveOutputStream;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.io.TempDir;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
Expand All @@ -45,6 +46,7 @@
import static io.fabric8.kubernetes.client.utils.Utils.generateId;
import static org.assertj.core.api.Assertions.assertThat;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(Build.class)
class BuildIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.fabric8.openshift.api.model.DeploymentConfig;
import io.fabric8.openshift.api.model.DeploymentConfigList;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.util.Objects;
Expand All @@ -31,6 +32,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(DeploymentConfig.class)
@LoadKubernetesManifests("/deploymentconfig-it.yml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.fabric8.openshift.api.model.ImageStreamBuilder;
import io.fabric8.openshift.api.model.ImageStreamList;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.util.Objects;
Expand All @@ -32,6 +33,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(ImageStream.class)
@LoadKubernetesManifests("/imagestream-it.yml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.fabric8.openshift.api.model.ImageStreamTagBuilder;
import io.fabric8.openshift.api.model.ImageStreamTagList;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.util.Optional;
Expand All @@ -31,6 +32,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(ImageStreamTag.class)
@LoadKubernetesManifests("/imagestreamtag-it.yml")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import io.fabric8.openshift.api.model.Project;
import io.fabric8.openshift.api.model.User;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;
Expand All @@ -44,6 +45,7 @@ class K8sAuthorizationOnOpenShiftIT {

OpenShiftClient client;

@Tag("OSCI")
@Test
void createRoleK8s() {
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import io.fabric8.openshift.api.model.SubjectRulesReview;
import io.fabric8.openshift.api.model.SubjectRulesReviewBuilder;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertFalse;
Expand Down Expand Up @@ -62,6 +63,7 @@ void createSubjectAccessReviewOpenShift() {
assertTrue(sarResponse.getAllowed());
}

@Tag("OSCI")
@Test
void createSubjectRulesReviewOpenShift() {
// Given
Expand All @@ -82,6 +84,7 @@ void createSubjectRulesReviewOpenShift() {
assertFalse(createdSrr.getStatus().getRules().isEmpty());
}

@Tag("OSCI")
@Test
void createSelfSubjectRulesReview() {
// Given
Expand All @@ -98,6 +101,7 @@ void createSelfSubjectRulesReview() {
assertFalse(createdSsrr.getStatus().getRules().isEmpty());
}

@Tag("OSCI")
@Test
void createLocalResourceAccessReview() {
// Given
Expand All @@ -117,6 +121,7 @@ void createLocalResourceAccessReview() {
assertFalse(rarr.getGroups().isEmpty());
}

@Tag("OSCI")
@Test
void createLocalSubjectAccessReview() {
// Given
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.fabric8.openshift.api.model.RouteBuilder;
import io.fabric8.openshift.api.model.RouteList;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import java.util.Collections;
Expand All @@ -33,6 +34,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(Route.class)
@LoadKubernetesManifests("/route-it.yml")
Expand Down Expand Up @@ -83,14 +85,12 @@ void createOrReplace() {

// When
route.getMetadata().setAnnotations(Collections.singletonMap("foo", "bar"));
route.getSpec().setHost("test.fabric8.io");
route = client.routes().createOrReplace(route);

// Then
assertNotNull(route);
assertEquals("route-createorreplace", route.getMetadata().getName());
assertEquals("bar", route.getMetadata().getAnnotations().get("foo"));
assertEquals("test.fabric8.io", route.getSpec().getHost());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
import io.fabric8.kubernetes.api.model.authorization.v1.SelfSubjectAccessReviewBuilder;
import io.fabric8.openshift.api.model.Project;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertTrue;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(Project.class)
class SelfSubjectAccessReviewIT {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
import io.fabric8.kubernetes.client.VersionInfo;
import io.fabric8.openshift.api.model.Project;
import io.fabric8.openshift.client.OpenShiftClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@Tag("OSCI")
@KubernetesTest(createEphemeralNamespace = false)
@RequireK8sSupport(Project.class)
class VersionIT {
Expand Down
10 changes: 5 additions & 5 deletions kubernetes-itests/src/test/resources/buildconfig-it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

---
kind: "BuildConfig"
apiVersion: "v1"
apiVersion: "build.openshift.io/v1"
metadata:
name: bc-get
spec:
Expand Down Expand Up @@ -45,7 +45,7 @@ spec:
name: "origin-ruby-sample:latest"
---
kind: "BuildConfig"
apiVersion: "v1"
apiVersion: "build.openshift.io/v1"
metadata:
name: bc-list
spec:
Expand Down Expand Up @@ -74,7 +74,7 @@ spec:
name: "origin-ruby-sample:latest"
---
kind: "BuildConfig"
apiVersion: "v1"
apiVersion: "build.openshift.io/v1"
metadata:
name: bc-update
spec:
Expand Down Expand Up @@ -103,7 +103,7 @@ spec:
name: "origin-ruby-sample:latest"
---
kind: "BuildConfig"
apiVersion: "v1"
apiVersion: "build.openshift.io/v1"
metadata:
name: bc-delete
spec:
Expand Down Expand Up @@ -132,7 +132,7 @@ spec:
name: "origin-ruby-sample:latest"
---
kind: "BuildConfig"
apiVersion: "v1"
apiVersion: "build.openshift.io/v1"
metadata:
name: bc-createorreplace
spec:
Expand Down
12 changes: 6 additions & 6 deletions kubernetes-itests/src/test/resources/deploymentconfig-it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

---
kind: "DeploymentConfig"
apiVersion: "v1"
apiVersion: "apps.openshift.io/v1"
metadata:
name: dc-get
spec:
Expand Down Expand Up @@ -48,7 +48,7 @@ spec:
type: "Rolling"
---
kind: "DeploymentConfig"
apiVersion: "v1"
apiVersion: "apps.openshift.io/v1"
metadata:
name: dc-list
spec:
Expand Down Expand Up @@ -80,7 +80,7 @@ spec:
type: "Rolling"
---
kind: "DeploymentConfig"
apiVersion: "v1"
apiVersion: "apps.openshift.io/v1"
metadata:
name: dc-update
spec:
Expand Down Expand Up @@ -112,7 +112,7 @@ spec:
type: "Rolling"
---
kind: "DeploymentConfig"
apiVersion: "v1"
apiVersion: "apps.openshift.io/v1"
metadata:
name: dc-scale
spec:
Expand Down Expand Up @@ -144,7 +144,7 @@ spec:
type: "Rolling"
---
kind: "DeploymentConfig"
apiVersion: "v1"
apiVersion: "apps.openshift.io/v1"
metadata:
name: dc-delete
spec:
Expand Down Expand Up @@ -176,7 +176,7 @@ spec:
type: "Rolling"
---
kind: "DeploymentConfig"
apiVersion: "v1"
apiVersion: "apps.openshift.io/v1"
metadata:
name: dc-createorreplace
spec:
Expand Down
Loading

0 comments on commit 0299873

Please sign in to comment.