Add mkdir task tests

Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
Vasek - Tom C 2021-12-17 20:29:15 +01:00
parent 09c427f1cf
commit d2580f4a73
No known key found for this signature in database
GPG Key ID: 175D82E572427960
6 changed files with 122 additions and 1 deletions

View File

@ -51,7 +51,24 @@ setup() {
cd "$TESTDIR"/tasks/copy
"$DAGGER" --europa up ./copy_exec.cue
"$DAGGER" --europa up ./copy_file.cue
run "$DAGGER" --europa up ./copy_exec_invalid.cue
assert_failure
}
@test "task: #Mkdir" {
cd "$TESTDIR"/tasks/mkdir
"$DAGGER" --europa up ./mkdir.cue
}
@test "task: #Mkdir: create parents" {
cd "$TESTDIR"/tasks/mkdir
"$DAGGER" --europa up ./mkdir_parents.cue
}
@test "task: #Mkdir failure: disable parents creation" {
cd "$TESTDIR"/tasks/mkdir
run "$DAGGER" --europa up ./mkdir_failure_disable_parents.cue
assert_failure
}

View File

@ -0,0 +1 @@
module: ""

View File

@ -0,0 +1,3 @@
# generated by dagger
alpha.dagger.io
dagger.lock

View File

@ -0,0 +1,33 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
)
engine.#Plan & {
actions: {
image: engine.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
mkdir: engine.#Mkdir & {
input: image.output
path: "/test"
}
writeChecker: engine.#WriteFile & {
input: mkdir.output
path: "/test/foo"
contents: "bar"
mode: 700
}
readChecker: engine.#ReadFile & {
input: writeChecker.output
path: "/test/foo"
} & {
// assert result
contents: "bar"
}
}
}

View File

@ -0,0 +1,34 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
)
engine.#Plan & {
actions: {
image: engine.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
mkdir: engine.#Mkdir & {
input: image.output
path: "/test/baz"
parents: false
}
writeChecker: engine.#WriteFile & {
input: mkdir.output
path: "/test/baz/foo"
contents: "bar"
mode: 700
}
readChecker: engine.#ReadFile & {
input: writeChecker.output
path: "/test/baz/foo"
} & {
// assert result
contents: "bar"
}
}
}

View File

@ -0,0 +1,33 @@
package main
import (
"alpha.dagger.io/europa/dagger/engine"
)
engine.#Plan & {
actions: {
image: engine.#Pull & {
source: "alpine:3.15.0@sha256:e7d88de73db3d3fd9b2d63aa7f447a10fd0220b7cbf39803c803f2af9ba256b3"
}
mkdir: engine.#Mkdir & {
input: image.output
path: "/test/baz"
}
writeChecker: engine.#WriteFile & {
input: mkdir.output
path: "/test/baz/foo"
contents: "bar"
mode: 700
}
readChecker: engine.#ReadFile & {
input: writeChecker.output
path: "/test/baz/foo"
} & {
// assert result
contents: "bar"
}
}
}