Skip to content

Commit

Permalink
Add test-e2e-openshift and make it green…
Browse files Browse the repository at this point in the history
… even if it's fake.

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester committed Dec 1, 2023
1 parent c93994d commit b5250ea
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ test-integration:
test-e2e: install
$(BATS_CORE) $(BATS_FLAGS) $(ARGS) $(E2E_TESTS)

# Run all the end-to-end tests against the current openshift context.
# It is used mainly by the CI and ideally shouldn't differ that much from test-e2e
.PHONY: prepare-e2e-openshift
prepare-e2e-openshift:
./hack/install-osp.sh $(OSP_VERSION)
.PHONY: test-e2e-openshift
test-e2e-openshift: prepare-e2e-openshift
test-e2e-openshift: test-e2e

# act runs the github actions workflows, so by default only running the test workflow (integration
# and end-to-end) to avoid running the release workflow accidently
act: ARGS = --workflows=./.github/workflows/test.yaml
Expand Down
69 changes: 69 additions & 0 deletions hack/install-osp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
# Install OpenShift Pipelines on the current cluster

set -o errexit
set -o nounset
set -o pipefail

readonly export DEPLOYMENT_TIMEOUT="${DEPLOYMENT_TIMEOUT:-5m}"

function fail() {
echo "ERROR: ${*}" >&2
exit 1
}

function rollout_status() {
local namespace="${1}"
local deployment="${2}"

if ! kubectl --namespace="${namespace}" --timeout=${DEPLOYMENT_TIMEOUT} \
rollout status deployment "${deployment}"; then
fail "'${namespace}/${deployment}' is not deployed as expected!"
fi
}

OSP_VERSION=${1:-latest}
shift

CHANNEL=""

case "$OSP_VERSION" in
nightly)
echo "Not supporting nightly just yet"
# FIXME add support for it
exit 0
;;
latest)
CHANNEL="latest"
;;
*)
CHANNEL="pipelines-$OSP_VERSION"
;;
esac

echo "Installing OpenShift Pipelines from channel ${CHANNEL}"
cat <<EOF | oc apply -f-
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: openshift-pipelines-operator-rh
namespace: openshift-operators
spec:
channel: ${CHANNEL}
name: openshift-pipelines-operator-rh
source: redhat-operators
sourceNamespace: openshift-marketplace
EOF

# FIXME(vdemeester) do better than waiting 2m for the namespace to appear
echo "Waiting for OpenShift Pipelines Operator to be available"
sleep 120

rollout_status "openshift-pipelines" "tekton-pipelines-controller"
rollout_status "openshift-pipelines" "tekton-pipelines-webhook"

oc get -n openshift-pipelines pods
tkn version

# Make sure we are on the default project
oc project default

0 comments on commit b5250ea

Please sign in to comment.