Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: test scripts #1316

Merged
merged 1 commit into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/oci-devworkspace-happy-path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ overrideDefaults() {
}

deployChe() {
deployEclipseCheOnWithOperator "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
deployEclipseCheOnWithOperator "chectl" "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}

initDefaults
Expand Down
4 changes: 2 additions & 2 deletions .ci/oci-nightly-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ overrideDefaults() {

runTests() {
deployDevWorkspaceOperator "stable"
deployEclipseCheOnWithOperator "openshift" ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} "false"
updateEclipseChe "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
deployEclipseCheOnWithOperator "chectl" "openshift" ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} "false"
updateEclipseChe "chectl" "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}

initDefaults
Expand Down
2 changes: 1 addition & 1 deletion .ci/oci-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ overrideDefaults() {
}

runTests() {
deployEclipseCheOnWithOperator "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
deployEclipseCheOnWithOperator "chectl" "openshift" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}

initDefaults
Expand Down
51 changes: 41 additions & 10 deletions .github/bin/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ getLatestsStableVersions() {
tags=$(git ls-remote --refs --tags operator | sed -n 's|.*refs/tags/\(7.*\)|\1|p' | awk -F. '{ print ($1*1000)+($2*10)+$3" "$1"."$2"."$3}' | sort | tac)
export PREVIOUS_PACKAGE_VERSION=$(echo "${tags}" | sed -n 2p | cut -d ' ' -f2)
export LAST_PACKAGE_VERSION=$(echo "${tags}" | sed -n 1p | cut -d ' ' -f2)
git remote remove operator
}

copyChectlTemplates() {
Expand Down Expand Up @@ -188,9 +189,10 @@ copyCheOperatorImageToMinikube() {
}

deployEclipseCheOnWithOperator() {
local platform=$1
local templates=$2
local customimage=$3
local chectlbin=$1
local platform=$2
local templates=$3
local customimage=$4

local domainFlag=""
if [[ ${platform} == "minikube" ]]; then
Expand All @@ -207,7 +209,7 @@ deployEclipseCheOnWithOperator() {
yq -riSY '.spec.template.spec.containers[0].imagePullPolicy = "IfNotPresent"' ${templates}/che-operator/operator.yaml
fi

chectl server:deploy \
${chectlbin} server:deploy \
--batch \
--platform ${platform} \
--installer operator \
Expand All @@ -218,9 +220,10 @@ deployEclipseCheOnWithOperator() {
}

updateEclipseChe() {
local platform=$1
local templates=$2
local customimage=$3
local chectlbin=$1
local platform=$2
local templates=$3
local customimage=$4

if [[ ${customimage} == "true" ]]; then
if [[ ${platform} == "minikube" ]]; then
Expand All @@ -232,7 +235,7 @@ updateEclipseChe() {
yq -riSY '.spec.template.spec.containers[0].imagePullPolicy = "IfNotPresent"' ${templates}/che-operator/operator.yaml
fi

chectl server:update \
${chectlbin} server:update \
--batch \
--templates ${templates}

Expand Down Expand Up @@ -283,6 +286,26 @@ getCheVersionFromExistedCSV() {
}

getCSVName() {
local n=0
local csvNumber=0

while [ $n -le 24 ]
do
csvNumber=$(oc get csv -n openshift-operators --no-headers=true | grep eclipse-che-preview-openshift | wc -l)
if [[ $csvNumber == 1 ]]; then
break
return
fi

sleep 5
n=$(( n+1 ))
done

if [[ $csvNumber != 1 ]]; then
echo "[ERROR] More than 1 Eclipse Che CSV found"
exit 1
fi

oc get csv -n openshift-operators | grep eclipse-che-preview-openshift | awk '{print $1}'
}

Expand Down Expand Up @@ -381,8 +404,8 @@ spec:
EOF

sleep 10s
if [[ ${installPlan} == "Manual"} ]]; then
kubectl wait subscription/"${packageName}" -n openshift-operators --for=condition=InstallPlanPending --timeout=120s
if [[ ${installPlan} == "Manual" ]]; then
kubectl wait subscription/${name} -n openshift-operators --for=condition=InstallPlanPending --timeout=120s
fi
}

Expand Down Expand Up @@ -480,3 +503,11 @@ forcePullingOlmImages() {
kubectl wait --for=condition=complete --timeout=30s job/force-pulling-olm-images-job -n openshift-operators
kubectl delete job/force-pulling-olm-images-job -n openshift-operators
}

installchectl() {
local version=$1
curl -L https://github.com/che-incubator/chectl/releases/download/${version}/chectl-linux-x64.tar.gz -o /tmp/chectl-${version}.tar.gz
rm -rf /tmp/chectl-${version}
mkdir /tmp/chectl-${version}
tar -xvzf /tmp/chectl-${version}.tar.gz -C /tmp/chectl-${version}
}
2 changes: 1 addition & 1 deletion .github/bin/minikube/test-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source "${OPERATOR_REPO}"/.github/bin/common.sh
trap "catchFinish" EXIT SIGINT

runTest() {
deployEclipseCheOnWithOperator "minikube" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
deployEclipseCheOnWithOperator "chectl" "minikube" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}

initDefaults
Expand Down
5 changes: 3 additions & 2 deletions .github/bin/minikube/test-upgrade-from-stable-to-next.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ source "${OPERATOR_REPO}"/.github/bin/common.sh
trap "catchFinish" EXIT SIGINT

runTest() {
deployEclipseCheOnWithOperator "minikube" ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} "false"
updateEclipseChe "minikube" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
deployEclipseCheOnWithOperator "/tmp/chectl-${LAST_PACKAGE_VERSION}/chectl/bin/run" "minikube" ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} "false"
updateEclipseChe "chectl" "minikube" ${CURRENT_OPERATOR_VERSION_TEMPLATE_PATH} "true"
}

initDefaults
initTemplates
installchectl ${LAST_PACKAGE_VERSION}
runTest
5 changes: 3 additions & 2 deletions .github/bin/minikube/test-upgrade-from-stable-to-stable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ source "${OPERATOR_REPO}"/.github/bin/common.sh
trap "catchFinish" EXIT SIGINT

runTest() {
deployEclipseCheOnWithOperator "minikube" ${PREVIOUS_OPERATOR_VERSION_TEMPLATE_PATH} "false"
updateEclipseChe "minikube" ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} "false"
deployEclipseCheOnWithOperator "/tmp/chectl-${PREVIOUS_PACKAGE_VERSION}/chectl/bin/run" "minikube" ${PREVIOUS_OPERATOR_VERSION_TEMPLATE_PATH} "false"
updateEclipseChe "chectl" "minikube" ${LAST_OPERATOR_VERSION_TEMPLATE_PATH} "false"
}

initDefaults
initTemplates
installchectl ${PREVIOUS_PACKAGE_VERSION}
runTest