initial
This commit is contained in:
parent
5c42451610
commit
dc2720ab02
5 changed files with 16 additions and 12 deletions
|
@ -156,17 +156,18 @@ nextcloud-integrationtest:
|
||||||
stage: integrationtest
|
stage: integrationtest
|
||||||
image: docker:latest
|
image: docker:latest
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_COMMIT_BRANCH == "local-integration-test"'
|
- if: '$CI_COMMIT_BRANCH == "integration-test-w-o-db-backup"'
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
before_script:
|
before_script:
|
||||||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||||
- apk add bash
|
- apk add bash
|
||||||
|
- docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
||||||
|
#- docker run --name "$name" -d --privileged --tmpfs /run --tmpfs /var/run --restart always -e K3S_TOKEN=12345678901234 -e K3S_KUBECONFIG_OUTPUT=./kubeconfig.yaml -e K3S_KUBECONFIG_MODE=666 -v k3s-server:/var/lib/rancher/k3s:z -v $(pwd):/output:z -p 6443:6443 -p 80:80 -p 443:443 rancher/k3s server --cluster-init --tls-san k3stesthost --tls-san cloudhost
|
||||||
|
#- docker run --privileged -dit --name c4k_test -v /var/run/docker.sock:/var/run/docker.sock $CI_REGISTRY_IMAGE
|
||||||
|
- docker inspect -f '{{.State.Running}}' c4k_test
|
||||||
script:
|
script:
|
||||||
- echo "---------- Integration test -------------"
|
- echo "---------- Integration test -------------"
|
||||||
# - docker build --pull -t "$CI_REGISTRY_IMAGE" .
|
|
||||||
# - docker run --privileged -dit --name provs_test -v /var/run/docker.sock:/var/run/docker.sock $CI_REGISTRY_IMAGE
|
|
||||||
# - docker inspect -f '{{.State.Running}}' provs_test
|
|
||||||
- ls -l
|
- ls -l
|
||||||
- pwd
|
- pwd
|
||||||
- bash ./src/test/resources/local-integration-test/setup-docker.sh
|
- bash ./src/test/resources/local-integration-test/setup-docker.sh
|
||||||
|
|
|
@ -14,7 +14,8 @@ function main() {
|
||||||
file_env RESTIC_DAYS_TO_KEEP 14
|
file_env RESTIC_DAYS_TO_KEEP 14
|
||||||
|
|
||||||
backup-roles 'oc_'
|
backup-roles 'oc_'
|
||||||
backup-db-dump
|
;backup-db-dump
|
||||||
|
echo test-content > /var/backups/tmpfile
|
||||||
backup-directory '/var/backups/'
|
backup-directory '/var/backups/'
|
||||||
|
|
||||||
end-maintenance.sh
|
end-maintenance.sh
|
||||||
|
|
|
@ -40,8 +40,9 @@ docker exec integration-test sh -c "apk add bash"
|
||||||
Set up docker container integration-test:
|
Set up docker container integration-test:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker cp setup-docker.sh integration-test:/
|
docker cp ../../../../../c4k-nextcloud/ integration-test:/
|
||||||
docker exec -it integration-test sh
|
docker exec -it integration-test sh
|
||||||
|
cd /c4k-nextcloud/src/test/resources/local-integration-test
|
||||||
./setup-docker.sh
|
./setup-docker.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,10 @@ set -ex
|
||||||
|
|
||||||
docker volume create k3s-server
|
docker volume create k3s-server
|
||||||
|
|
||||||
docker run -d --privileged --tmpfs /run --tmpfs /var/run --restart always -e K3S_TOKEN=12345678901234 -e K3S_KUBECONFIG_OUTPUT=./kubeconfig.yaml -e K3S_KUBECONFIG_MODE=666 -v k3s-server:/var/lib/rancher/k3s:z -v $(pwd):/output:z -p 6443:6443 -p 80:80 -p 443:443 rancher/k3s server --cluster-init
|
container_name='intst'
|
||||||
|
|
||||||
|
[[ $(docker ps -f "name=$name" --format '{{.Names}}') == $name ]] ||
|
||||||
|
docker run --name "$name" -d --privileged --tmpfs /run --tmpfs /var/run --restart always -e K3S_TOKEN=12345678901234 -e K3S_KUBECONFIG_OUTPUT=./kubeconfig.yaml -e K3S_KUBECONFIG_MODE=666 -v k3s-server:/var/lib/rancher/k3s:z -v $(pwd):/output:z -p 6443:6443 -p 80:80 -p 443:443 rancher/k3s server --cluster-init --tls-san k3stesthost --tls-san cloudhost
|
||||||
|
|
||||||
export timeout=30; while [ ! -f /var/lib/docker/volumes/k3s-server/_data/server/kubeconfig.yaml ]; do if [ "$timeout" == 0 ]; then echo "ERROR: Timeout while waiting for file."; break; fi; sleep 1; ((timeout--)); done
|
export timeout=30; while [ ! -f /var/lib/docker/volumes/k3s-server/_data/server/kubeconfig.yaml ]; do if [ "$timeout" == 0 ]; then echo "ERROR: Timeout while waiting for file."; break; fi; sleep 1; ((timeout--)); done
|
||||||
|
|
||||||
|
@ -21,7 +24,7 @@ fi
|
||||||
mkdir -p $HOME/.kube/
|
mkdir -p $HOME/.kube/
|
||||||
cp /var/lib/docker/volumes/k3s-server/_data/server/kubeconfig.yaml $HOME/.kube/config
|
cp /var/lib/docker/volumes/k3s-server/_data/server/kubeconfig.yaml $HOME/.kube/config
|
||||||
|
|
||||||
apk add git curl bash sudo openjdk8 wget
|
apk add wget curl bash sudo openjdk8
|
||||||
wget -P /etc/apk/keys/ https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
|
wget -P /etc/apk/keys/ https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
|
||||||
apk add --no-cache --repository=https://apkproxy.herokuapp.com/sgerrand/alpine-pkg-leiningen leiningen
|
apk add --no-cache --repository=https://apkproxy.herokuapp.com/sgerrand/alpine-pkg-leiningen leiningen
|
||||||
|
|
||||||
|
@ -29,6 +32,4 @@ curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.22.0/bin/l
|
||||||
chmod +x ./kubectl
|
chmod +x ./kubectl
|
||||||
mv ./kubectl /usr/local/bin/kubectl
|
mv ./kubectl /usr/local/bin/kubectl
|
||||||
|
|
||||||
git clone https://gitlab.com/domaindrivenarchitecture/c4k-nextcloud.git
|
|
||||||
cd /c4k-nextcloud && git checkout local-integration-test
|
|
||||||
cd /c4k-nextcloud/src/test/resources/local-integration-test && ./setup-local-s3-on-k3d.sh
|
cd /c4k-nextcloud/src/test/resources/local-integration-test && ./setup-local-s3-on-k3d.sh
|
|
@ -30,9 +30,9 @@ function main()
|
||||||
kubectl scale deployment backup-restore --replicas 1
|
kubectl scale deployment backup-restore --replicas 1
|
||||||
|
|
||||||
echo
|
echo
|
||||||
until curl --silent --fail k3stesthost:80 k3stesthost/health | grep -o '"s3": "available"'
|
until curl --fail --silent k3stesthost/health | grep -oe '"s3": "available"' -oe '"s3": "running"'
|
||||||
do
|
do
|
||||||
curl --fail k3stesthost:80 k3stesthost/health
|
curl --fail k3stesthost/health
|
||||||
echo "[INFO] Waiting for s3 running"
|
echo "[INFO] Waiting for s3 running"
|
||||||
sleep 3
|
sleep 3
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue