From 6fa892d32e5e5ef0a19ff0e9a447dc3e49155aea Mon Sep 17 00:00:00 2001 From: Michele Sciabarra Date: Sat, 4 Nov 2023 23:04:06 +0000 Subject: [PATCH 1/3] test-olaris --- Taskfile.yml | 3 ++- TaskfileTest.yml | 25 +++++++++++++++++++++++++ olaris | 2 +- test-olaris/Dockerfile | 21 +++++++++++++++++++++ {testplan => test-olaris}/aws.txt | 0 {testplan => test-olaris}/docker.txt | 0 test-olaris/info.bats | 11 +++++++++++ 7 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 TaskfileTest.yml create mode 100644 test-olaris/Dockerfile rename {testplan => test-olaris}/aws.txt (100%) rename {testplan => test-olaris}/docker.txt (100%) create mode 100644 test-olaris/info.bats 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..92fd15d --- /dev/null +++ b/TaskfileTest.yml @@ -0,0 +1,25 @@ +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 + + all: + - task: build + - task: run + + diff --git a/olaris b/olaris index 6fd8e1e..98c1f72 160000 --- a/olaris +++ b/olaris @@ -1 +1 @@ -Subproject commit 6fd8e1e3123cdb661cf12d3b8c88df8197de43c1 +Subproject commit 98c1f726ed562c544364c0acfa45957d635e4863 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/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..2c40a45 --- /dev/null +++ b/test-olaris/info.bats @@ -0,0 +1,11 @@ +setup() { + load '../test_helper/bats-support/load' + load '../test_helper/bats-assert/load' + export NO_COLOR=1 +} + +@test "info" { + run nuv -info + assert_line "NUV_ROOT: /root/olaris" + assert_success +} \ No newline at end of file From 06ba926b49203e0d5324827f559b909a9359f30d Mon Sep 17 00:00:00 2001 From: Michele Sciabarra Date: Sun, 5 Nov 2023 11:24:46 +0000 Subject: [PATCH 2/3] test-olaris --- .gitignore | 1 + TaskfileTest.yml | 5 +++++ olaris | 2 +- test-olaris/info.bats | 4 +++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 2cb36b9..70a39f6 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,7 @@ _* conf/gcp conf/aws kubeconfig +*.kubeconfig env-github .env* runtimes.json diff --git a/TaskfileTest.yml b/TaskfileTest.yml index 92fd15d..2554cfa 100644 --- a/TaskfileTest.yml +++ b/TaskfileTest.yml @@ -18,8 +18,13 @@ tasks: --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 98c1f72..00fc532 160000 --- a/olaris +++ b/olaris @@ -1 +1 @@ -Subproject commit 98c1f726ed562c544364c0acfa45957d635e4863 +Subproject commit 00fc532e72288f9e532ffc826e448d413ce8f61a diff --git a/test-olaris/info.bats b/test-olaris/info.bats index 2c40a45..bd8cc26 100644 --- a/test-olaris/info.bats +++ b/test-olaris/info.bats @@ -1,6 +1,8 @@ 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 } @@ -8,4 +10,4 @@ setup() { run nuv -info assert_line "NUV_ROOT: /root/olaris" assert_success -} \ No newline at end of file +} From 661d64d151b73a0cec8e9c83491d550cbfda5285 Mon Sep 17 00:00:00 2001 From: Michele Sciabarra Date: Sun, 5 Nov 2023 11:31:33 +0000 Subject: [PATCH 3/3] todo --- .gitignore | 1 - test-olaris/TODO.txt | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test-olaris/TODO.txt diff --git a/.gitignore b/.gitignore index 70a39f6..cfc9014 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ old/ -TODO.txt playground.txt attic/ .vscode/ 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 +