Merge pull request #1663 from dubo-dubon-duponey/fix1
Fix flaky tests in outputs
This commit is contained in:
commit
3e9fd390c7
2
.github/workflows/test-integration.yml
vendored
2
.github/workflows/test-integration.yml
vendored
@ -8,6 +8,7 @@ on:
|
|||||||
- '**.bash'
|
- '**.bash'
|
||||||
- '**.go'
|
- '**.go'
|
||||||
- '**.cue'
|
- '**.cue'
|
||||||
|
- '**.bats'
|
||||||
- 'Makefile'
|
- 'Makefile'
|
||||||
- 'go.mod'
|
- 'go.mod'
|
||||||
- 'go.sum'
|
- 'go.sum'
|
||||||
@ -19,6 +20,7 @@ on:
|
|||||||
- '**.bash'
|
- '**.bash'
|
||||||
- '**.go'
|
- '**.go'
|
||||||
- '**.cue'
|
- '**.cue'
|
||||||
|
- '**.bats'
|
||||||
- 'Makefile'
|
- 'Makefile'
|
||||||
- 'go.mod'
|
- 'go.mod'
|
||||||
- 'go.sum'
|
- 'go.sum'
|
||||||
|
2
.github/workflows/test-universe.yml
vendored
2
.github/workflows/test-universe.yml
vendored
@ -8,6 +8,7 @@ on:
|
|||||||
- '**.bash'
|
- '**.bash'
|
||||||
- '**.go'
|
- '**.go'
|
||||||
- '**.cue'
|
- '**.cue'
|
||||||
|
- '**.bats'
|
||||||
- 'Makefile'
|
- 'Makefile'
|
||||||
- 'go.mod'
|
- 'go.mod'
|
||||||
- 'go.sum'
|
- 'go.sum'
|
||||||
@ -19,6 +20,7 @@ on:
|
|||||||
- '**.bash'
|
- '**.bash'
|
||||||
- '**.go'
|
- '**.go'
|
||||||
- '**.cue'
|
- '**.cue'
|
||||||
|
- '**.bats'
|
||||||
- 'Makefile'
|
- 'Makefile'
|
||||||
- 'go.mod'
|
- 'go.mod'
|
||||||
- 'go.sum'
|
- 'go.sum'
|
||||||
|
@ -96,17 +96,19 @@ setup() {
|
|||||||
@test "plan/outputs/directories" {
|
@test "plan/outputs/directories" {
|
||||||
cd "$TESTDIR"/plan/outputs/directories
|
cd "$TESTDIR"/plan/outputs/directories
|
||||||
|
|
||||||
rm -f "./out/test"
|
|
||||||
"$DAGGER" up ./outputs.cue
|
"$DAGGER" up ./outputs.cue
|
||||||
assert [ -f "./out/test" ]
|
assert [ -f "./out/test_outputs" ]
|
||||||
|
|
||||||
|
rm -f "./out/test_outputs"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan/outputs/directories relative paths" {
|
@test "plan/outputs/directories relative paths" {
|
||||||
cd "$TESTDIR"/plan
|
cd "$TESTDIR"/plan
|
||||||
|
|
||||||
rm -f "./outputs/directories/out/test"
|
"$DAGGER" up ./outputs/directories/relative.cue
|
||||||
"$DAGGER" up ./outputs/directories/outputs.cue
|
assert [ -f "./outputs/directories/out/test_relative" ]
|
||||||
assert [ -f "./outputs/directories/out/test" ]
|
|
||||||
|
rm -f "./outputs/directories/out/test_relative"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan/outputs/files normal usage" {
|
@test "plan/outputs/files normal usage" {
|
||||||
@ -114,22 +116,22 @@ setup() {
|
|||||||
|
|
||||||
"$DAGGER" up ./usage.cue
|
"$DAGGER" up ./usage.cue
|
||||||
|
|
||||||
run ./test.sh
|
run ./test_usage
|
||||||
assert_output "Hello World!"
|
assert_output "Hello World!"
|
||||||
|
|
||||||
run ls -l "./test.sh"
|
run ls -l "./test_usage"
|
||||||
assert_output --partial "-rwxr-x---"
|
assert_output --partial "-rwxr-x---"
|
||||||
|
|
||||||
rm -f "./test.sh"
|
rm -f "./test_usage"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan/outputs/files relative path" {
|
@test "plan/outputs/files relative path" {
|
||||||
cd "$TESTDIR"/plan
|
cd "$TESTDIR"/plan
|
||||||
|
|
||||||
"$DAGGER" up ./outputs/files/usage.cue
|
"$DAGGER" up ./outputs/files/relative.cue
|
||||||
assert [ -f "./outputs/files/test.sh" ]
|
assert [ -f "./outputs/files/test_relative" ]
|
||||||
|
|
||||||
rm -f "./outputs/files/test.sh"
|
rm -f "./outputs/files/test_relative"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan/outputs/files default permissions" {
|
@test "plan/outputs/files default permissions" {
|
||||||
@ -137,10 +139,10 @@ setup() {
|
|||||||
|
|
||||||
"$DAGGER" up ./default_permissions.cue
|
"$DAGGER" up ./default_permissions.cue
|
||||||
|
|
||||||
run ls -l "./test"
|
run ls -l "./test_default_permissions"
|
||||||
assert_output --partial "-rw-r--r--"
|
assert_output --partial "-rw-r--r--"
|
||||||
|
|
||||||
rm -f "./test"
|
rm -f "./test_default_permissions"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan/outputs/files no contents" {
|
@test "plan/outputs/files no contents" {
|
||||||
@ -150,7 +152,9 @@ setup() {
|
|||||||
assert_failure
|
assert_failure
|
||||||
assert_output --partial "contents is not set"
|
assert_output --partial "contents is not set"
|
||||||
|
|
||||||
assert [ ! -f "./test" ]
|
assert [ ! -f "./test_no_contents" ]
|
||||||
|
|
||||||
|
rm -f "./test_no_contents"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "plan/platform" {
|
@test "plan/platform" {
|
||||||
|
@ -7,12 +7,12 @@ import (
|
|||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
actions: data: dagger.#WriteFile & {
|
actions: data: dagger.#WriteFile & {
|
||||||
input: dagger.#Scratch
|
input: dagger.#Scratch
|
||||||
path: "/test"
|
path: "/test_outputs"
|
||||||
permissions: 0o600
|
permissions: 0o600
|
||||||
contents: "foobar"
|
contents: "foobar"
|
||||||
}
|
}
|
||||||
|
|
||||||
outputs: directories: test: {
|
outputs: directories: test_outputs: {
|
||||||
contents: actions.data.output
|
contents: actions.data.output
|
||||||
dest: "./out"
|
dest: "./out"
|
||||||
}
|
}
|
||||||
|
19
tests/plan/outputs/directories/relative.cue
Normal file
19
tests/plan/outputs/directories/relative.cue
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"dagger.io/dagger"
|
||||||
|
)
|
||||||
|
|
||||||
|
dagger.#Plan & {
|
||||||
|
actions: data: dagger.#WriteFile & {
|
||||||
|
input: dagger.#Scratch
|
||||||
|
path: "/test_relative"
|
||||||
|
permissions: 0o600
|
||||||
|
contents: "foobar"
|
||||||
|
}
|
||||||
|
|
||||||
|
outputs: directories: test_relative: {
|
||||||
|
contents: actions.data.output
|
||||||
|
dest: "./out"
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,6 @@ import "dagger.io/dagger"
|
|||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
outputs: files: test: {
|
outputs: files: test: {
|
||||||
contents: "foobar"
|
contents: "foobar"
|
||||||
dest: "./test"
|
dest: "./test_default_permissions"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@ package main
|
|||||||
import "dagger.io/dagger"
|
import "dagger.io/dagger"
|
||||||
|
|
||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
outputs: files: test: dest: "./test"
|
outputs: files: test: dest: "./test_no_contents"
|
||||||
}
|
}
|
||||||
|
15
tests/plan/outputs/files/relative.cue
Normal file
15
tests/plan/outputs/files/relative.cue
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "dagger.io/dagger"
|
||||||
|
|
||||||
|
dagger.#Plan & {
|
||||||
|
outputs: files: {
|
||||||
|
[path=string]: dest: path
|
||||||
|
test_relative: contents: """
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
echo "Hello World!"
|
||||||
|
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@ import "dagger.io/dagger"
|
|||||||
dagger.#Plan & {
|
dagger.#Plan & {
|
||||||
outputs: files: {
|
outputs: files: {
|
||||||
[path=string]: dest: path
|
[path=string]: dest: path
|
||||||
"test.sh": {
|
test_usage: {
|
||||||
contents: """
|
contents: """
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
Reference in New Issue
Block a user