Skip to content

Commit

Permalink
Merge pull request #88 from garethahealy/prow
Browse files Browse the repository at this point in the history
Added test files which can be used by prow
  • Loading branch information
eformat committed Feb 9, 2021
2 parents cab7ec3 + 09ffa5c commit 3efc775
Show file tree
Hide file tree
Showing 13 changed files with 406 additions and 6 deletions.
21 changes: 21 additions & 0 deletions _test/prow.sh
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

run() {
echo "Running helm for all..."

for file in $(find . -name ".test.sh" -type f | sort | xargs); do
pushd $(dirname $file) > /dev/null

echo ""
echo "## $(pwd)"
echo ""

./.test.sh install || exit $?
./.test.sh test || exit $?
./.test.sh cleanup || exit $?

popd > /dev/null
done
}

run
63 changes: 63 additions & 0 deletions charts/dev-ex-dashboard/.test.sh
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

trap "exit 1" TERM
export TOP_PID=$$

export project_name="devexdashboard-$(date +'%d%m%Y')"

install() {
echo "install - $(pwd)"

oc new-project ${project_name}
helm template . | oc apply -f -
}

test() {
echo "test - $(pwd)"

oc rollout status DeploymentConfig/dev-ex-dashboard -n ${project_name} --watch=true

timeout 2m bash <<"EOT"
run() {
host=$(oc get route/dev-ex-dashboard -o jsonpath='{.spec.host}' -n ${project_name})
echo "Attempting $host"
while [[ $(curl -L -k -s -o /dev/null -w '%{http_code}' https://${host}) != '200' ]]; do
sleep 10
done
}
run
EOT

if [[ $? != 0 ]]; then
echo "CURL timed-out. Failing"

host=$(oc get route/dev-ex-dashboard -o jsonpath='{.spec.host}' -n ${project_name})
curl -L -k -vvv "https://${host}"
exit 1
fi

echo "Test complete"
}

cleanup() {
echo "cleanup - $(pwd)"
oc delete project/${project_name}
}

# Process arguments
case $1 in
install)
install
;;
test)
test
;;
cleanup)
cleanup
;;
*)
echo "Not an option"
exit 1
esac
2 changes: 1 addition & 1 deletion charts/dev-ex-dashboard/Chart.yaml
Expand Up @@ -3,7 +3,7 @@ name: dev-ex-dashboard
description: A Helm chart to deploy the Developer Experience Dashboard
type: application
# HelmChart Version
version: 0.0.3
version: 0.0.4
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: v1.0
Expand Down
63 changes: 63 additions & 0 deletions charts/etherpad/.test.sh
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

trap "exit 1" TERM
export TOP_PID=$$

export project_name="etherpad-$(date +'%d%m%Y')"

install() {
echo "install - $(pwd)"

oc new-project ${project_name}
helm template etherpad . | oc apply -f -
}

test() {
echo "test - $(pwd)"

oc rollout status Deployment/etherpad -n ${project_name} --watch=true

timeout 2m bash <<"EOT"
run() {
host=$(oc get route/etherpad -o jsonpath='{.spec.host}' -n ${project_name})
echo "Attempting $host"
while [[ $(curl -L -k -s -o /dev/null -w '%{http_code}' https://${host}) != '200' ]]; do
sleep 10
done
}
run
EOT

if [[ $? != 0 ]]; then
echo "CURL timed-out. Failing"

host=$(oc get route/etherpad -o jsonpath='{.spec.host}' -n ${project_name})
curl -L -k -vvv "https://${host}"
exit 1
fi

echo "Test complete"
}

cleanup() {
echo "cleanup - $(pwd)"
oc delete project/${project_name}
}

# Process arguments
case $1 in
install)
install
;;
test)
test
;;
cleanup)
cleanup
;;
*)
echo "Not an option"
exit 1
esac
2 changes: 1 addition & 1 deletion charts/etherpad/Chart.yaml
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: etherpad
description: A Helm chart for etherpad lite
type: application
version: 0.0.3
version: 0.0.4
appVersion: latest
home: https://github.com/redhat-cop/helm-charts
icon: https://pbs.twimg.com/profile_images/1336377123964145665/2gTadaDt_400x400.jpg
Expand Down
63 changes: 63 additions & 0 deletions charts/jenkins/.test.sh
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

trap "exit 1" TERM
export TOP_PID=$$

export project_name="jenkins-$(date +'%d%m%Y')"

install() {
echo "install - $(pwd)"

oc new-project ${project_name}
helm template . | oc apply -f -
}

test() {
echo "test - $(pwd)"

oc rollout status DeploymentConfig/jenkins -n ${project_name} --watch=true

timeout 2m bash <<"EOT"
run() {
host=$(oc get route/jenkins -o jsonpath='{.spec.host}' -n ${project_name})
echo "Attempting $host"
while [[ $(curl -H "Authorization: Bearer $(oc whoami -t)" -L -k -s -o /dev/null -w '%{http_code}' https://${host}) != '200' ]]; do
sleep 10
done
}
run
EOT

if [[ $? != 0 ]]; then
echo "CURL timed-out. Failing"

host=$(oc get route/jenkins -o jsonpath='{.spec.host}' -n ${project_name})
curl -H "Authorization: Bearer $(oc whoami -t)" -L -k -vvv "https://${host}"
exit 1
fi

echo "Test complete"
}

cleanup() {
echo "cleanup - $(pwd)"
oc delete project/${project_name}
}

# Process arguments
case $1 in
install)
install
;;
test)
test
;;
cleanup)
cleanup
;;
*)
echo "Not an option"
exit 1
esac
2 changes: 1 addition & 1 deletion charts/jenkins/Chart.yaml
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "v2.222.1"
description: A Helm chart for deploying Jenkins on OpenShift with some additional build agents and plugins
name: jenkins
version: 0.0.22
version: 0.0.23
home: https://github.com/redhat-cop/helm-charts
icon: https://www.jenkins.io/images/logos/jenkins/256.png
maintainers:
Expand Down
64 changes: 64 additions & 0 deletions charts/pact-broker/.test.sh
@@ -0,0 +1,64 @@
#!/usr/bin/env bash

trap "exit 1" TERM
export TOP_PID=$$

export project_name="pactbroker-$(date +'%d%m%Y')"

install() {
echo "install - $(pwd)"

oc new-project ${project_name}
helm template . | oc apply -f -
}

test() {
echo "test - $(pwd)"

oc rollout status DeploymentConfig/postgresql-pact-broker -n ${project_name} --watch=true
oc rollout status DeploymentConfig/pact-broker -n ${project_name} --watch=true

timeout 5m bash <<"EOT"
run() {
host=$(oc get route/pact-broker -o jsonpath='{.spec.host}' -n ${project_name})
echo "Attempting $host"
while [[ $(curl --user dev:CHANGE-ME -L -k -s -o /dev/null -w '%{http_code}' http://${host}) != '200' ]]; do
sleep 10
done
}
run
EOT

if [[ $? != 0 ]]; then
echo "CURL timed-out. Failing"

host=$(oc get route/pact-broker -o jsonpath='{.spec.host}' -n ${project_name})
curl --user dev:CHANGE-ME -L -k -vvv "http://${host}"
exit 1
fi

echo "Test complete"
}

cleanup() {
echo "cleanup - $(pwd)"
oc delete project/${project_name}
}

# Process arguments
case $1 in
install)
install
;;
test)
test
;;
cleanup)
cleanup
;;
*)
echo "Not an option"
exit 1
esac
2 changes: 1 addition & 1 deletion charts/pact-broker/Chart.yaml
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "latest"
description: A Helm chart for deploying Pact Broker on OpenShift 🔗
name: pact-broker
version: 0.0.5
version: 0.0.6
home: https://github.com/redhat-cop/helm-charts
icon: https://img.stackshare.io/service/11305/pact.png
maintainers:
Expand Down
63 changes: 63 additions & 0 deletions charts/sonarqube/.test.sh
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

trap "exit 1" TERM
export TOP_PID=$$

export project_name="sonarqube-$(date +'%d%m%Y')"

install() {
echo "install - $(pwd)"

oc new-project ${project_name}
helm template sonarqube . | oc apply -f -
}

test() {
echo "test - $(pwd)"

oc rollout status Deployment/sonarqube-sonarqube -n ${project_name} --watch=true

timeout 2m bash <<"EOT"
run() {
host=$(oc get route/sonarqube -o jsonpath='{.spec.host}' -n ${project_name})
echo "Attempting $host"
while [[ $(curl -L -k -s -o /dev/null -w '%{http_code}' http://${host}) != '200' ]]; do
sleep 10
done
}
run
EOT

if [[ $? != 0 ]]; then
echo "CURL timed-out. Failing"

host=$(oc get route/sonarqube -o jsonpath='{.spec.host}' -n ${project_name})
curl -L -k -vvv "http://${host}"
exit 1
fi

echo "Test complete"
}

cleanup() {
echo "cleanup - $(pwd)"
oc delete project/${project_name}
}

# Process arguments
case $1 in
install)
install
;;
test)
test
;;
cleanup)
cleanup
;;
*)
echo "Not an option"
exit 1
esac
2 changes: 1 addition & 1 deletion charts/sonarqube/Chart.yaml
@@ -1,7 +1,7 @@
apiVersion: v2
name: sonarqube
description: SonarQube is an open sourced code quality scanning tool
version: 0.0.11
version: 0.0.12
appVersion: "8.2-community"
home: https://github.com/redhat-cop/helm-charts
keywords:
Expand Down

0 comments on commit 3efc775

Please sign in to comment.