Merge pull request #350 from TomChv/tests-aws-eks

This commit is contained in:
Andrea Luzzardi 2021-04-24 14:04:11 -07:00 committed by GitHub
commit 7bcd28582f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 2 deletions

View File

@ -1,7 +1,6 @@
package eks
import (
"dagger.io/dagger"
"dagger.io/dagger/op"
"dagger.io/aws"
)
@ -19,16 +18,19 @@ import (
// kubeconfig is the generated kube configuration file
kubeconfig: {
dagger.#Secret
// FIXME There is a problem with dagger.#Secret type
string
#up: [
op.#Load & {
from: aws.#CLI
},
op.#WriteFile & {
dest: "/entrypoint.sh"
content: #Code
},
op.#Exec & {
always: true
args: [

View File

@ -43,3 +43,8 @@ setup() {
"$DAGGER" compute "$TESTDIR"/stdlib/aws/s3 --input-dir TestDirectory="$TESTDIR"/stdlib/aws/s3/testdata --input-yaml "$TESTDIR"/stdlib/aws/inputs.yaml
}
@test "stdlib: aws" {
skip_unless_secrets_available "$TESTDIR"/stdlib/aws/inputs.yaml
"$DAGGER" compute "$TESTDIR"/stdlib/aws/eks --input-yaml "$TESTDIR"/stdlib/aws/inputs.yaml
}

View File

@ -0,0 +1,53 @@
package eks
import (
"dagger.io/aws"
"dagger.io/aws/eks"
"dagger.io/kubernetes"
"dagger.io/dagger/op"
)
TestConfig: awsConfig: aws.#Config & {
region: "us-east-2"
}
TestCluster: eks.#KubeConfig & {
config: TestConfig.awsConfig
clusterName: *"dagger-example-eks-cluster" | string
}
TestEks: {
#GetPods:
"""
kubectl get pods -A
"""
#up: [
op.#Load & {
from: kubernetes.#Kubectl
},
op.#WriteFile & {
dest: "/kubeconfig"
content: TestCluster.kubeconfig
},
op.#WriteFile & {
dest: "/getPods.sh"
content: #GetPods
},
op.#Exec & {
always: true
args: [
"/bin/bash",
"--noprofile",
"--norc",
"-eo",
"pipefail",
"/getPods.sh",
]
env: KUBECONFIG: "/kubeconfig"
},
]
}