Move tests plan from dagger dir to universe

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau
2021-06-24 21:01:17 +02:00
parent 36cf20ae2d
commit c99e39ec9c
69 changed files with 215 additions and 166 deletions

View File

@@ -0,0 +1,86 @@
package main
import (
"alpha.dagger.io/gcp"
"alpha.dagger.io/gcp/gcr"
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/random"
)
TestConfig: gcpConfig: gcp.#Config
TestGCR: {
suffix: random.#String & {
seed: ""
}
repository: "gcr.io/dagger-ci/test"
tag: "test-gcr-\(suffix.out)"
creds: gcr.#Credentials & {
config: TestConfig.gcpConfig
}
push: {
ref: "\(repository):\(tag)"
#up: [
op.#DockerBuild & {
dockerfile: """
FROM alpine
RUN echo \(suffix.out) > /test
"""
},
op.#DockerLogin & {
target: repository
username: creds.username
secret: creds.secret
},
op.#PushContainer & {
"ref": ref
},
]
}
pull: #up: [
op.#DockerLogin & {
target: push.ref
username: creds.username
secret: creds.secret
},
op.#FetchContainer & {
ref: push.ref
},
]
verify: #up: [
op.#Load & {
from: pull
},
op.#Exec & {
always: true
args: [
"sh", "-c", "test $(cat test) = \(suffix.out)",
]
},
]
verifyBuild: #up: [
op.#DockerLogin & {
target: push.ref
username: creds.username
secret: creds.secret
},
op.#DockerBuild & {
dockerfile: #"""
FROM \#(push.ref)
RUN test $(cat test) = \#(suffix.out)
"""#
},
]
}

View File

@@ -0,0 +1,32 @@
package gke
import (
"alpha.dagger.io/gcp"
"alpha.dagger.io/gcp/gke"
"alpha.dagger.io/kubernetes"
"alpha.dagger.io/dagger/op"
)
TestConfig: gcpConfig: gcp.#Config
TestCluster: gke.#KubeConfig & {
config: TestConfig.gcpConfig
clusterName: "test-cluster"
}
TestGKE: #up: [
op.#Load & {
from: kubernetes.#Kubectl
},
op.#WriteFile & {
dest: "/kubeconfig"
content: TestCluster.kubeconfig
},
op.#Exec & {
always: true
args: ["kubectl", "get", "nodes"]
env: KUBECONFIG: "/kubeconfig"
},
]