From 408f147fab04f9c4f249cec3bdcf3354dfaf539e Mon Sep 17 00:00:00 2001 From: Andrea Luzzardi Date: Fri, 17 Sep 2021 11:51:06 -0700 Subject: [PATCH] socket: add tests Signed-off-by: Andrea Luzzardi --- tests/compute/dockersocket/main.cue | 18 ------------------ tests/core.bats | 12 +++++++++--- tests/core/socket/main.cue | 23 +++++++++++++++++++++++ 3 files changed, 32 insertions(+), 21 deletions(-) delete mode 100644 tests/compute/dockersocket/main.cue create mode 100644 tests/core/socket/main.cue diff --git a/tests/compute/dockersocket/main.cue b/tests/compute/dockersocket/main.cue deleted file mode 100644 index a554623c..00000000 --- a/tests/compute/dockersocket/main.cue +++ /dev/null @@ -1,18 +0,0 @@ -package main - -import ( - "alpha.dagger.io/dagger/op" - "alpha.dagger.io/docker" -) - -TestDockerSocket: #up: [ - op.#Load & { - from: docker.#Client - }, - - op.#Exec & { - always: true - mount: "/var/run/docker.sock": "docker.sock" - args: ["docker", "info"] - }, -] diff --git a/tests/core.bats b/tests/core.bats index a3e7e582..57ec21a5 100644 --- a/tests/core.bats +++ b/tests/core.bats @@ -148,9 +148,15 @@ setup() { assert_output --partial "secret=mySecret;hash=" } -@test "compute: docker socket" { - skip "docker socket support disabled" - run "$DAGGER" compute "$TESTDIR"/compute/dockersocket +@test "core: socket" { + dagger init + + dagger_new_with_plan test-socket "$TESTDIR"/core/socket + + # Set dir input + "$DAGGER" input socket dockersocket /var/run/docker.sock + + "$DAGGER" up } @test "compute: exclude" { diff --git a/tests/core/socket/main.cue b/tests/core/socket/main.cue new file mode 100644 index 00000000..5bd4ef1e --- /dev/null +++ b/tests/core/socket/main.cue @@ -0,0 +1,23 @@ +package main + +import ( + "alpha.dagger.io/dagger" + "alpha.dagger.io/dagger/op" + "alpha.dagger.io/alpine" +) + +dockersocket: dagger.#Socket & dagger.#Input + +TestDockerSocket: #up: [ + op.#Load & { + from: alpine.#Image & { + package: "docker-cli": true + } + }, + + op.#Exec & { + always: true + mount: "/var/run/docker.sock": socket: dockersocket + args: ["docker", "info"] + }, +]