socket: add tests

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-09-17 11:51:06 -07:00
parent 5480fb991d
commit 408f147fab
3 changed files with 32 additions and 21 deletions

View File

@ -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"]
},
]

View File

@ -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" {

View File

@ -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"]
},
]