Skip to content
Snippets Groups Projects
Commit 94b78bd0 authored by thijsheijden's avatar thijsheijden
Browse files

Re-added integration stage to test if it works

parent 37c9d37c
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ stages:
- test
- build
- docker
# - integration
- integration
- deploy
lint:
......@@ -84,36 +84,36 @@ docker:
dependencies:
- build
# integration-tests:
# image: golang:1.16
# stage: integration
# only:
# - develop
# script:
# - apt-get install openssh-client curl -y >/dev/null
# - mkdir ~/.ssh/
# - eval $(ssh-agent -s)
# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
# - chmod 600 ~/.ssh/id_rsa
# - ssh-add ~/.ssh/id_rsa
# - echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
# - chmod 644 ~/.ssh/known_hosts
# - ssh -fN -L 1234:science-vs260.science.uu.nl:22 sivan@up.science.uu.nl
# # Copy kubernetes files over
# - scp -r -o StrictHostKeyChecking=no -P 1234 -i ~/.ssh/id_rsa integration-testing/pod.yml root@localhost:/root/kubernetes/integration/integrating-pod/pod.yml
# # Deploy all yml files
# - ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl apply -f /root/kubernetes/integration/integrating-pod/pod.yml"
# # Wait 5 seconds for the pod to start up
# - sleep 5
# # CURL the config json to the integration service and store the response in the environment variable 'output'
# - |
# output=$(curl -k --header "Content-Type: multipart/form-data" --request POST -F "configFile=@integration-testing/config.json;type=application/json" https://datastrophe.science.uu.nl/integration-test/start)
# - echo $output
# # Count the number of occurences of the word FAIL in the output, if this is 1 then the test has failed
# - count=$(echo $output | grep -c "FAIL")
# # Delete pod
# # - ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl delete -f /root/kubernetes/integration/integrating-pod/pod.yml"
# - if [[ $count = 1 ]]; then exit 1; else exit 0; fi
integration-tests:
image: golang:1.16
stage: integration
only:
- develop
script:
- apt-get install openssh-client curl -y >/dev/null
- mkdir ~/.ssh/
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-add ~/.ssh/id_rsa
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- ssh -fN -L 1234:science-vs260.science.uu.nl:22 sivan@up.science.uu.nl
# Copy kubernetes files over
- scp -r -o StrictHostKeyChecking=no -P 1234 -i ~/.ssh/id_rsa integration-testing/pod.yml root@localhost:/root/kubernetes/integration/integrating-pod/pod.yml
# Deploy all yml files
- ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl apply -f /root/kubernetes/integration/integrating-pod/pod.yml"
# Wait 5 seconds for the pod to start up
- sleep 5
# CURL the config json to the integration service and store the response in the environment variable 'output'
- |
output=$(curl -k --header "Content-Type: multipart/form-data" --request POST -F "configFile=@integration-testing/config.json;type=application/json" https://datastrophe.science.uu.nl/integration-test/start)
- echo $output
# Count the number of occurences of the word FAIL in the output, if this is 1 then the test has failed
- count=$(echo $output | grep -c "FAIL")
# Delete pod
- ssh -p 1234 -i ~/.ssh/id_rsa root@localhost "kubectl delete -f /root/kubernetes/integration/integrating-pod/pod.yml"
- if [[ $count = 1 ]]; then exit 1; else exit 0; fi
deploy:
stage: deploy
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment