From b691c95f2c8d8d6ec1e621bfd8600878239703ac Mon Sep 17 00:00:00 2001 From: Tom Chauveau Date: Fri, 16 Apr 2021 16:10:58 +0200 Subject: [PATCH 1/2] fix(tests): Improve the verification of local kubernetes cluster to ignore "kind: Config" field of kubeconfig fix(tests): Update documentation fix(tests): Enable kubernetes tests Signed-off-by: Tom Chauveau --- tests/README.md | 13 ++++--------- tests/helpers.bash | 2 +- tests/stdlib.bats | 2 -- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/tests/README.md b/tests/README.md index 05e70a66..31f91ed5 100644 --- a/tests/README.md +++ b/tests/README.md @@ -3,18 +3,13 @@ ## TL;DR ``` -# Get help -./test.sh --help +# Install dependancies +yarn --cwd . install # Run all tests -# You can also just call ./test.sh with no argument -# Also, `make integration` does exactly that -./test.sh all - -# Run one random dagger cue directory, with expectations on exit code, stdout, stderr -./test.sh fetch-git/nonexistent/ref --exit=1 --stdout= +yarn --cwd . test ``` -By default, the dagger binary is expected to be found in ../../cmd/dagger/dagger relative to the test.sh script. +By default, the `dagger` binary is expected to be found in `../cmd/dagger/dagger` relative to the `tests` directory. If you need to change this, pass along `DAGGER_BINARY=somewhere/dagger` diff --git a/tests/helpers.bash b/tests/helpers.bash index e1c31420..00f94b44 100644 --- a/tests/helpers.bash +++ b/tests/helpers.bash @@ -20,7 +20,7 @@ skip_unless_secrets_available() { } skip_unless_local_kube() { - if [ -f ~/.kube/config ] && grep -q "kind" ~/.kube/config &> /dev/null; then + if [ -f ~/.kube/config ] && grep -q "user: kind-kind" ~/.kube/config &> /dev/null && grep -q "127.0.0.1" ~/.kube/config &> /dev/null; then echo "Kubernetes available" else skip "local kubernetes cluster not available" diff --git a/tests/stdlib.bats b/tests/stdlib.bats index f4b88737..4f71b059 100644 --- a/tests/stdlib.bats +++ b/tests/stdlib.bats @@ -27,14 +27,12 @@ setup() { } @test "stdlib: kubernetes" { - skip "disabled" skip_unless_local_kube "$DAGGER" compute "$TESTDIR"/stdlib/kubernetes --input-dir kubeconfig=~/.kube } @test "stdlib: helm" { - skip "disabled" skip_unless_local_kube "$DAGGER" compute "$TESTDIR"/stdlib/kubernetes/helm --input-dir kubeconfig=~/.kube --input-dir TestHelmSimpleChart.deploy.chartSource="$TESTDIR"/stdlib/kubernetes/helm/testdata/mychart From 46b8b92002f228d7bcfcf728e06b97ddc28507cb Mon Sep 17 00:00:00 2001 From: Tom Chauveau Date: Fri, 16 Apr 2021 22:27:26 +0200 Subject: [PATCH 2/2] misc(README): update README.md to use bats tests Signed-off-by: Tom Chauveau --- tests/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/README.md b/tests/README.md index 31f91ed5..8a5db63f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -4,10 +4,10 @@ ``` # Install dependancies -yarn --cwd . install +yarn --cwd install # Run all tests -yarn --cwd . test +yarn --cwd test ``` By default, the `dagger` binary is expected to be found in `../cmd/dagger/dagger` relative to the `tests` directory.