Merge branch 'main' into cloudrun-support

This commit is contained in:
Tihomir Jovicic
2021-07-01 08:54:44 +02:00
267 changed files with 2667 additions and 1463 deletions

View File

@@ -69,8 +69,8 @@ setup() {
ln -s "$TESTDIR"/cli/packages "$DAGGER_WORKSPACE"/plan
"$DAGGER" new "a" --module "$DAGGER_WORKSPACE"/plan --package dagger.io/test/a
"$DAGGER" new "b" --module "$DAGGER_WORKSPACE"/plan --package dagger.io/test/b
"$DAGGER" new "a" --module "$DAGGER_WORKSPACE"/plan --package alpha.dagger.io/test/a
"$DAGGER" new "b" --module "$DAGGER_WORKSPACE"/plan --package alpha.dagger.io/test/b
"$DAGGER" up -e "a"
"$DAGGER" up -e "b"

View File

@@ -1,8 +1,8 @@
package testing
import (
"dagger.io/dagger/op"
"dagger.io/dagger"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/dagger"
)
source: dagger.#Artifact

View File

@@ -1,8 +1,8 @@
package testing
import (
"dagger.io/dagger/op"
"dagger.io/dagger"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/dagger"
)
source: dagger.#Artifact

View File

@@ -1,8 +1,8 @@
package main
import (
"dagger.io/dagger"
"dagger.io/aws"
"alpha.dagger.io/dagger"
"alpha.dagger.io/aws"
)
awsConfig: aws.#Config & {

View File

@@ -1,7 +1,7 @@
package main
import (
"dagger.io/dagger"
"alpha.dagger.io/dagger"
)
#A: {

View File

@@ -1,6 +1,6 @@
package a
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
exp: {
string

View File

@@ -1,6 +1,6 @@
package b
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
exp: {
string

View File

@@ -1 +1 @@
module: "dagger.io/test"
module: "alpha.dagger.io/test"

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
foo: "value"
bar: "another value"

View File

@@ -1,116 +0,0 @@
setup() {
load 'helpers'
common_setup
}
@test "compute: simple" {
run "$DAGGER" compute "$TESTDIR"/compute/invalid/string
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/bool
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/int
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/struct
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/success/noop
assert_success
assert_line '{"empty":{}}'
run "$DAGGER" compute "$TESTDIR"/compute/success/simple
assert_success
assert_line '{}'
run "$DAGGER" compute "$TESTDIR"/compute/success/overload/flat
assert_success
run "$DAGGER" compute "$TESTDIR"/compute/success/overload/wrapped
assert_success
run "$DAGGER" compute "$TESTDIR"/compute/success/exec-nocache
assert_success
}
@test "compute: dependencies" {
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/simple
assert_success
assert_line '{"A":{"result":"from A"},"B":{"result":"dependency from A"}}'
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/interpolation
assert_success
assert_line '{"A":{"result":"from A"},"B":{"result":"dependency from A"}}'
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/unmarshal
assert_success
assert_line '{"A":"{\"hello\": \"world\"}\n","B":{"result":"unmarshalled.hello=world"},"unmarshalled":{"hello":"world"}}'
}
@test "compute: inputs" {
run "$DAGGER" compute "$TESTDIR"/compute/input/simple
assert_success
assert_line '{}'
run "$DAGGER" compute --input-string 'in=foobar' "$TESTDIR"/compute/input/simple
assert_success
assert_line '{"in":"foobar","test":"received: foobar"}'
run "$DAGGER" compute "$TESTDIR"/compute/input/default
assert_success
assert_line '{"in":"default input","test":"received: default input"}'
run "$DAGGER" compute --input-string 'in=foobar' "$TESTDIR"/compute/input/default
assert_success
assert_line '{"in":"foobar","test":"received: foobar"}'
run "$DAGGER" compute --input-string=foobar "$TESTDIR"/compute/input/default
assert_failure
assert_output --partial 'failed to parse input: input-string'
run "$DAGGER" compute --input-dir=foobar "$TESTDIR"/compute/input/default
assert_failure
assert_output --partial 'failed to parse input: input-dir'
run "$DAGGER" compute --input-git=foobar "$TESTDIR"/compute/input/default
assert_failure
assert_output --partial 'failed to parse input: input-git'
}
@test "compute: secrets" {
# secrets used as environment variables must fail
run "$DAGGER" compute "$TESTDIR"/compute/secrets/invalid/env
assert_failure
assert_line --partial "conflicting values"
# strings passed as secrets must fail
run "$DAGGER" compute "$TESTDIR"/compute/secrets/invalid/string
assert_failure
# Setting a text input for a secret value should fail
run "$DAGGER" compute --input-string 'mySecret=SecretValue' "$TESTDIR"/compute/secrets/simple
assert_failure
# Now test with an actual secret and make sure it works
"$DAGGER" init
dagger_new_with_plan secrets "$TESTDIR"/compute/secrets/simple
"$DAGGER" input secret mySecret SecretValue
run "$DAGGER" up
assert_success
# Make sure the secret doesn't show in dagger query
run "$DAGGER" query mySecret.id -f text
assert_success
assert_output "secret=mySecret"
}
@test "compute: docker socket" {
skip "docker socket support disabled"
run "$DAGGER" compute "$TESTDIR"/compute/dockersocket
}
@test "compute: exclude" {
"$DAGGER" up -w "$TESTDIR"/compute/exclude
}

View File

@@ -1,8 +1,8 @@
package main
import (
"dagger.io/dagger/op"
"dagger.io/docker"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/docker"
)
TestDockerSocket: #up: [

View File

@@ -1,9 +1,9 @@
package testing
import (
"dagger.io/alpine"
"dagger.io/dagger"
"dagger.io/dagger/op"
"alpha.dagger.io/alpine"
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
)
TestData: dagger.#Artifact

View File

@@ -1,9 +1,9 @@
package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/op"
"dagger.io/alpine"
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
)
mySecret: dagger.#Secret

View File

@@ -1,8 +1,8 @@
package testing
import (
"dagger.io/dagger/op"
"dagger.io/alpine"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
)
mySecret: dagger.#Secret

View File

@@ -1,9 +1,9 @@
package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/op"
"dagger.io/alpine"
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
)
mySecret: dagger.#Secret

View File

@@ -1,8 +1,8 @@
package main
import (
"dagger.io/alpine"
"dagger.io/dagger/op"
"alpha.dagger.io/alpine"
"alpha.dagger.io/dagger/op"
)
rand: {

View File

@@ -4,12 +4,20 @@ setup() {
load 'helpers'
common_setup
# Use native Dagger environment here
unset DAGGER_WORKSPACE
}
# This file combines 2 types of tests:
# old-style tests: use 'dagger compute'
# new-style tests: use 'dagger up'
#
# For new tests, please adopt new-style.
# NOTE: you will need to 'unset DAGGER_WORKSPACE'
# at the beginning of each new-style test.
@test "core: inputs & outputs" {
# Use native Dagger environment here
unset DAGGER_WORKSPACE
# List available inputs
run dagger -e test-core input list
assert_success
@@ -33,3 +41,114 @@ setup() {
assert_output --partial 'Hello, world!'
}
@test "compute: simple" {
run "$DAGGER" compute "$TESTDIR"/compute/invalid/string
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/bool
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/int
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/invalid/struct
assert_failure
run "$DAGGER" compute "$TESTDIR"/compute/success/noop
assert_success
assert_line '{"empty":{}}'
run "$DAGGER" compute "$TESTDIR"/compute/success/simple
assert_success
assert_line '{}'
run "$DAGGER" compute "$TESTDIR"/compute/success/overload/flat
assert_success
run "$DAGGER" compute "$TESTDIR"/compute/success/overload/wrapped
assert_success
run "$DAGGER" compute "$TESTDIR"/compute/success/exec-nocache
assert_success
}
@test "compute: dependencies" {
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/simple
assert_success
assert_line '{"A":{"result":"from A"},"B":{"result":"dependency from A"}}'
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/interpolation
assert_success
assert_line '{"A":{"result":"from A"},"B":{"result":"dependency from A"}}'
run "$DAGGER" compute "$TESTDIR"/compute/dependencies/unmarshal
assert_success
assert_line '{"A":"{\"hello\": \"world\"}\n","B":{"result":"unmarshalled.hello=world"},"unmarshalled":{"hello":"world"}}'
}
@test "compute: inputs" {
run "$DAGGER" compute "$TESTDIR"/compute/input/simple
assert_success
assert_line '{}'
run "$DAGGER" compute --input-string 'in=foobar' "$TESTDIR"/compute/input/simple
assert_success
assert_line '{"in":"foobar","test":"received: foobar"}'
run "$DAGGER" compute "$TESTDIR"/compute/input/default
assert_success
assert_line '{"in":"default input","test":"received: default input"}'
run "$DAGGER" compute --input-string 'in=foobar' "$TESTDIR"/compute/input/default
assert_success
assert_line '{"in":"foobar","test":"received: foobar"}'
run "$DAGGER" compute --input-string=foobar "$TESTDIR"/compute/input/default
assert_failure
assert_output --partial 'failed to parse input: input-string'
run "$DAGGER" compute --input-dir=foobar "$TESTDIR"/compute/input/default
assert_failure
assert_output --partial 'failed to parse input: input-dir'
run "$DAGGER" compute --input-git=foobar "$TESTDIR"/compute/input/default
assert_failure
assert_output --partial 'failed to parse input: input-git'
}
@test "compute: secrets" {
# secrets used as environment variables must fail
run "$DAGGER" compute "$TESTDIR"/compute/secrets/invalid/env
assert_failure
assert_line --partial "conflicting values"
# strings passed as secrets must fail
run "$DAGGER" compute "$TESTDIR"/compute/secrets/invalid/string
assert_failure
# Setting a text input for a secret value should fail
run "$DAGGER" compute --input-string 'mySecret=SecretValue' "$TESTDIR"/compute/secrets/simple
assert_failure
# Now test with an actual secret and make sure it works
"$DAGGER" init
dagger_new_with_plan secrets "$TESTDIR"/compute/secrets/simple
"$DAGGER" input secret mySecret SecretValue
run "$DAGGER" up
assert_success
# Make sure the secret doesn't show in dagger query
run "$DAGGER" query mySecret.id -f text
assert_success
assert_output "secret=mySecret"
}
@test "compute: docker socket" {
skip "docker socket support disabled"
run "$DAGGER" compute "$TESTDIR"/compute/dockersocket
}
@test "compute: exclude" {
"$DAGGER" up -w "$TESTDIR"/compute/exclude
}

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestCacheCopyLoadAlpine: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestComponent: #up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestScriptCopy: {
string

View File

@@ -1,8 +1,8 @@
package testing
import (
"dagger.io/dagger"
"dagger.io/dagger/op"
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
)
// Set to `--input-dir=./tests/dockerbuild/testdata`

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
bar: string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
hello: "world"
bar: string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
hello: "world"
bar: string

View File

@@ -1 +1 @@
module: "dagger.io/testing"
module: "alpha.dagger.io/testing"

View File

@@ -1,8 +1,8 @@
package testing
import (
"dagger.io/dagger/op"
"dagger.io/def"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/def"
)
#up: [

View File

@@ -1 +1 @@
module: "dagger.io/testing"
module: "alpha.dagger.io/testing"

View File

@@ -1,8 +1,8 @@
package testing
import (
"dagger.io/nonoptional"
"dagger.io/dagger/op"
"alpha.dagger.io/nonoptional"
"alpha.dagger.io/dagger/op"
)
#up: [

View File

@@ -1 +1 @@
module: "dagger.io/testing"
module: "alpha.dagger.io/testing"

View File

@@ -1,8 +1,8 @@
package testing
import (
"dagger.io/optional"
"dagger.io/dagger/op"
"alpha.dagger.io/optional"
"alpha.dagger.io/dagger/op"
)
#up: [

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportBool: {
bool

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportConcurrency1: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportFloat: {
float

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportInvalidFormat: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportInvalidValidation: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportScalar: {
bool

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportNumber: {
number

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportString: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportStringValidation: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestExportScalar: {
bool

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestBusybox1: #up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
// XXX WATCHOUT
// Once buildkit has pulled that digest, it will stay cached and happily succeed WHATEVER the image name then is

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchGit & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
repo1: #up: [
op.#FetchGit & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchGit & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchGit & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchGit & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#up: [
op.#FetchGit & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
test1: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestComponent: #up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
test: {
string

View File

@@ -1,7 +1,7 @@
package testing
import (
"dagger.io/dagger/op"
"alpha.dagger.io/dagger/op"
)
TestMountCache: {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
test: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestInvalidMountPath: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestMountTmpfs: {
string

View File

@@ -1,9 +1,9 @@
package main
import (
"dagger.io/dagger/op"
"dagger.io/alpine"
"dagger.io/random"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
"alpha.dagger.io/random"
)
registry: {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestInvalidExecSubdir: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestInvalidPathSubdir: {
string

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
#TestContainer: #up: [
op.#FetchContainer & {

View File

@@ -1,6 +1,6 @@
package testing
import "dagger.io/dagger/op"
import "alpha.dagger.io/dagger/op"
TestSimpleSubdir: {
string

View File

@@ -1,11 +1,11 @@
package main
import (
"dagger.io/dagger"
"dagger.io/dagger/op"
"dagger.io/alpine"
"dagger.io/docker"
"dagger.io/random"
"alpha.dagger.io/dagger"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/alpine"
"alpha.dagger.io/docker"
"alpha.dagger.io/random"
)
source: dagger.#Artifact