2021-04-16 01:08:45 +02:00
|
|
|
setup() {
|
|
|
|
load 'helpers'
|
|
|
|
|
|
|
|
common_setup
|
|
|
|
}
|
|
|
|
|
2021-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
2021-04-16 01:08:45 +02:00
|
|
|
@test "stdlib: go" {
|
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/go --input-dir TestData="$TESTDIR"/stdlib/go/testdata
|
|
|
|
}
|
|
|
|
|
2021-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
2021-04-16 01:08:45 +02:00
|
|
|
@test "stdlib: file" {
|
|
|
|
"$DAGGER" compute "$TESTDIR"/stdlib/file
|
|
|
|
}
|
|
|
|
|
2021-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
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-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
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-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
2021-04-16 01:08:45 +02:00
|
|
|
@test "stdlib: helm" {
|
2021-06-09 00:49:36 +02:00
|
|
|
skip "helm is broken"
|
2021-04-16 01:08:45 +02:00
|
|
|
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-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
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-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
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-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
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-06-10 15:43:02 +02:00
|
|
|
# FIXME: move to universe/universe.bats
|
|
|
|
# Assigned to: <ADD YOUR NAME HERE>
|
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"
|
|
|
|
}
|