diff --git a/.gitignore b/.gitignore index 2cb36b9..cfc9014 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ old/ -TODO.txt playground.txt attic/ .vscode/ @@ -23,6 +22,7 @@ _* conf/gcp conf/aws kubeconfig +*.kubeconfig env-github .env* runtimes.json diff --git a/Taskfile.yml b/Taskfile.yml index 74ff644..f822b71 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -33,7 +33,8 @@ includes: aws: ./TaskfileAWS.yml gcp: ./TaskfileGCloud.yml azure: ./TaskfileAzure.yml - + test: ./TaskfileTest.yml + tasks: default: task --list-all setup: { silent: true } diff --git a/TaskfileTest.yml b/TaskfileTest.yml new file mode 100644 index 0000000..2554cfa --- /dev/null +++ b/TaskfileTest.yml @@ -0,0 +1,30 @@ +version: '3' + +tasks: + + enter: > + docker run -ti --net=host + -v $PWD/olaris:/root/olaris + -v $PWD/test-olaris:/root/test-olaris + --mount source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind + test-olaris bash + + build: docker build test-olaris -t test-olaris --load + + run: > + docker run -ti --net=host + -v $PWD/olaris:/root/olaris + -v $PWD/test-olaris:/root/test-olaris + --mount source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind + test-olaris bats test-olaris + + export: + - nuv util kube export FILE=test-olaris/aks.kubeconfig NAME=aks-nuvolaris-testing + - nuv util kube export FILE=test-olaris/eks.kubeconfig NAME=eks-nuvolaris-testing + + all: + - task: build + - task: export + - task: run + + diff --git a/olaris b/olaris index 6fd8e1e..00fc532 160000 --- a/olaris +++ b/olaris @@ -1 +1 @@ -Subproject commit 6fd8e1e3123cdb661cf12d3b8c88df8197de43c1 +Subproject commit 00fc532e72288f9e532ffc826e448d413ce8f61a diff --git a/test-olaris/Dockerfile b/test-olaris/Dockerfile new file mode 100644 index 0000000..a242c71 --- /dev/null +++ b/test-olaris/Dockerfile @@ -0,0 +1,21 @@ +FROM ubuntu:22.04 +RUN apt-get update && apt-get install -y git jq wget curl +WORKDIR /tmp +RUN git clone https://github.com/bats-core/bats-core.git ;\ + cd bats-core ; ./install.sh /usr/local +RUN curl -fsSL https://get.docker.com | bash +WORKDIR /root +RUN mkdir test_helper ;\ + cd test_helper ;\ + git clone https://github.com/bats-core/bats-support ;\ + git clone https://github.com/bats-core/bats-file ;\ + git clone https://github.com/bats-core/bats-assert ;\ + git clone https://github.com/bats-core/bats-detik +ENV NUV_BRANCH=3.0.0-testing +RUN VER="$(curl https://raw.githubusercontent.com/nuvolaris/olaris/3.0.0-testing/nuvroot.json | jq .version -r)" ;\ + ARCH="$(dpkg --print-architecture)";\ + URL="https://github.com/nuvolaris/nuv/releases/download/$VER/nuv_${VER}_${ARCH}.deb" ;\ + wget --no-verbose $URL -O nuv.deb ;\ + dpkg -i nuv.deb ;\ + nuv -update ;\ + nuv -info diff --git a/test-olaris/TODO.txt b/test-olaris/TODO.txt new file mode 100644 index 0000000..d479dc9 --- /dev/null +++ b/test-olaris/TODO.txt @@ -0,0 +1,10 @@ +# TODO (and test) + +- when you switch the configuration, read back, apihost, email/tls, enabled services + +- test you can switch configurations and be able to use admin + +- test the secrets are propagated back to the users + +- test secrets are propagated to users + diff --git a/testplan/aws.txt b/test-olaris/aws.txt similarity index 100% rename from testplan/aws.txt rename to test-olaris/aws.txt diff --git a/testplan/docker.txt b/test-olaris/docker.txt similarity index 100% rename from testplan/docker.txt rename to test-olaris/docker.txt diff --git a/test-olaris/info.bats b/test-olaris/info.bats new file mode 100644 index 0000000..bd8cc26 --- /dev/null +++ b/test-olaris/info.bats @@ -0,0 +1,13 @@ +setup() { + load '../test_helper/bats-support/load' + load '../test_helper/bats-assert/load' + nuv util kube import FILE=test-olaris/aks.kubeconfig NAME=aks + nuv util kube import FILE=test-olaris/eks.kubeconfig NAME=eks + export NO_COLOR=1 +} + +@test "info" { + run nuv -info + assert_line "NUV_ROOT: /root/olaris" + assert_success +}