2021-04-16 01:08:45 +02:00
|
|
|
setup() {
|
|
|
|
load 'helpers'
|
|
|
|
|
|
|
|
common_setup
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "stdlib: alpine" {
|
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/alpine
|
|
|
|
}
|
|
|
|
|
2021-05-13 01:32:02 +02:00
|
|
|
@test "stdlib: yarn" {
|
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/js/yarn --input-dir TestData="$TESTDIR"/stdlib/js/yarn/testdata
|
2021-04-16 01:08:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "stdlib: go" {
|
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/go --input-dir TestData="$TESTDIR"/stdlib/go/testdata
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "stdlib: file" {
|
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/file
|
|
|
|
}
|
|
|
|
|
|
|
|
@test "stdlib: netlify" {
|
2021-05-27 18:22:41 +02:00
|
|
|
"$DAGGER" up -w "$TESTDIR"/stdlib/netlify/
|
2021-04-16 01:08:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@test "stdlib: kubernetes" {
|
|
|
|
skip_unless_local_kube
|
|
|
|
|
2021-06-03 16:28:03 +02:00
|
|
|
"$DAGGER" init
|
|
|
|
dagger_new_with_plan kubernetes "$TESTDIR"/stdlib/kubernetes/
|
|
|
|
|
|
|
|
run "$DAGGER" input -e "kubernetes" secret kubeconfig -f ~/.kube/config
|
|
|
|
assert_success
|
|
|
|
|
|
|
|
run "$DAGGER" up -e "kubernetes"
|
|
|
|
assert_success
|
2021-04-16 01:08:45 +02:00
|
|
|
}
|
|
|
|
|
2021-04-17 01:34:32 +02:00
|
|
|
@test "stdlib: kustomize" {
|
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/kubernetes/kustomize --input-dir TestKustomize.kustom.source="$TESTDIR"/stdlib/kubernetes/kustomize/testdata
|
|
|
|
}
|
|
|
|
|
2021-04-16 01:08:45 +02:00
|
|
|
@test "stdlib: helm" {
|
|
|
|
skip_unless_local_kube
|
|
|
|
|
2021-06-03 16:28:03 +02:00
|
|
|
"$DAGGER" init
|
|
|
|
dagger_new_with_plan helm "$TESTDIR"/stdlib/kubernetes/helm
|
|
|
|
|
|
|
|
run "$DAGGER" input -e "helm" secret kubeconfig -f ~/.kube/config
|
|
|
|
assert_success
|
|
|
|
|
|
|
|
cp -R "$TESTDIR"/stdlib/kubernetes/helm/testdata/mychart "$DAGGER_WORKSPACE"/testdata
|
|
|
|
run "$DAGGER" input -e "helm" dir TestHelmSimpleChart.deploy.chartSource "$DAGGER_WORKSPACE"/testdata
|
|
|
|
assert_success
|
|
|
|
|
|
|
|
run "$DAGGER" up -e "helm"
|
|
|
|
assert_success
|
2021-04-16 01:08:45 +02:00
|
|
|
}
|
2021-04-22 19:14:17 +02:00
|
|
|
|
2021-05-20 01:34:11 +02:00
|
|
|
@test "stdlib: aws: s3" {
|
2021-05-27 03:03:48 +02:00
|
|
|
"$DAGGER" up -w "$TESTDIR"/stdlib/aws/s3
|
2021-04-22 17:30:58 +02:00
|
|
|
}
|
2021-04-24 18:57:55 +02:00
|
|
|
|
2021-05-20 01:34:11 +02:00
|
|
|
@test "stdlib: aws: eks" {
|
2021-05-27 18:22:41 +02:00
|
|
|
"$DAGGER" up -w "$TESTDIR"/stdlib/aws/eks
|
2021-04-24 18:57:55 +02:00
|
|
|
}
|
|
|
|
|
2021-05-20 01:34:11 +02:00
|
|
|
@test "stdlib: aws: ecr" {
|
2021-05-27 03:03:48 +02:00
|
|
|
"$DAGGER" up -w "$TESTDIR"/stdlib/aws/ecr
|
2021-04-30 01:11:59 +02:00
|
|
|
}
|
|
|
|
|
2021-05-20 01:34:11 +02:00
|
|
|
@test "stdlib: gcp: gke" {
|
2021-05-28 04:11:01 +02:00
|
|
|
"$DAGGER" up -w "$TESTDIR"/stdlib/gcp/gke
|
2021-05-20 01:34:11 +02:00
|
|
|
}
|
|
|
|
|
2021-05-20 02:45:09 +02:00
|
|
|
@test "stdlib: gcp: gcr" {
|
2021-05-28 04:11:01 +02:00
|
|
|
"$DAGGER" up -w "$TESTDIR"/stdlib/gcp/gcr
|
2021-05-20 02:45:09 +02:00
|
|
|
}
|
|
|
|
|
2021-05-21 17:18:30 +02:00
|
|
|
@test "stdlib: docker: build" {
|
2021-05-06 22:27:45 +02:00
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/docker/build/ --input-dir source="$TESTDIR"/stdlib/docker/build
|
|
|
|
}
|
|
|
|
|
2021-05-21 17:18:30 +02:00
|
|
|
@test "stdlib: docker: dockerfile" {
|
2021-05-06 22:27:45 +02:00
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/docker/dockerfile/ --input-dir source="$TESTDIR"/stdlib/docker/dockerfile/testdata
|
|
|
|
}
|
2021-05-13 18:52:22 +02:00
|
|
|
|
2021-05-21 17:18:30 +02:00
|
|
|
@test "stdlib: docker: push-and-pull" {
|
2021-05-13 18:52:22 +02:00
|
|
|
skip_unless_secrets_available "$TESTDIR"/stdlib/docker/push-pull/inputs.yaml
|
|
|
|
|
|
|
|
# check that they succeed with the credentials
|
|
|
|
run "$DAGGER" compute --input-yaml "$TESTDIR"/stdlib/docker/push-pull/inputs.yaml --input-dir source="$TESTDIR"/stdlib/docker/push-pull/testdata "$TESTDIR"/stdlib/docker/push-pull/
|
|
|
|
assert_success
|
|
|
|
}
|
|
|
|
|
2021-05-21 17:18:30 +02:00
|
|
|
@test "stdlib: docker: run" {
|
2021-06-07 22:29:42 +02:00
|
|
|
# FIXME: local run disabled
|
2021-06-05 01:57:31 +02:00
|
|
|
# Local run
|
2021-06-07 22:29:42 +02:00
|
|
|
# run "$DAGGER" up -w "$TESTDIR"/stdlib/docker/run/local/
|
|
|
|
# assert_success
|
2021-05-21 17:18:30 +02:00
|
|
|
|
2021-06-05 01:57:31 +02:00
|
|
|
# SSH key
|
|
|
|
run "$DAGGER" up -w "$TESTDIR"/stdlib/docker/run/ssh/
|
2021-06-03 13:59:22 +02:00
|
|
|
assert_success
|
2021-05-21 17:18:30 +02:00
|
|
|
|
2021-06-05 01:57:31 +02:00
|
|
|
# SSH passphrase
|
|
|
|
run "$DAGGER" up -w "$TESTDIR"/stdlib/docker/run/ssh-passphrase/
|
|
|
|
assert_success
|
|
|
|
|
|
|
|
# Wrong passphrase
|
|
|
|
run "$DAGGER" up -w "$TESTDIR"/stdlib/docker/run/ssh-wrong-passphrase/
|
2021-05-21 17:18:30 +02:00
|
|
|
assert_failure
|
2021-05-20 19:26:24 +02:00
|
|
|
}
|
|
|
|
|
2021-04-30 01:11:59 +02:00
|
|
|
@test "stdlib: terraform" {
|
2021-05-28 22:50:28 +02:00
|
|
|
skip_unless_secrets_available "$TESTDIR"/stdlib/terraform/s3/inputs.yaml
|
2021-04-30 01:11:59 +02:00
|
|
|
|
2021-05-26 00:14:39 +02:00
|
|
|
"$DAGGER" init
|
|
|
|
dagger_new_with_plan terraform "$TESTDIR"/stdlib/terraform/s3
|
|
|
|
|
|
|
|
cp -R "$TESTDIR"/stdlib/terraform/s3/testdata "$DAGGER_WORKSPACE"/testdata
|
|
|
|
"$DAGGER" -e terraform input dir TestData "$DAGGER_WORKSPACE"/testdata
|
2021-05-28 22:50:28 +02:00
|
|
|
sops -d "$TESTDIR"/stdlib/terraform/s3/inputs.yaml | "$DAGGER" -e "terraform" input yaml "" -f -
|
2021-04-30 01:11:59 +02:00
|
|
|
|
|
|
|
# it must fail because of a missing var
|
|
|
|
run "$DAGGER" up -e terraform
|
|
|
|
assert_failure
|
|
|
|
|
|
|
|
# add the var and try again
|
|
|
|
"$DAGGER" -e terraform input text TestTerraform.apply.tfvars.input "42"
|
|
|
|
run "$DAGGER" up -e terraform
|
|
|
|
assert_success
|
|
|
|
|
|
|
|
# ensure the tfvar was passed correctly
|
|
|
|
run "$DAGGER" query -e terraform \
|
|
|
|
TestTerraform.apply.output.input.value -f text
|
|
|
|
assert_success
|
|
|
|
assert_output "42"
|
|
|
|
|
|
|
|
# ensure the random value is always the same
|
|
|
|
# this proves we're effectively using the s3 backend
|
|
|
|
run "$DAGGER" query -e terraform \
|
|
|
|
TestTerraform.apply.output.random.value -f json
|
|
|
|
assert_success
|
|
|
|
assert_output "36"
|
|
|
|
}
|