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

@@ -1,32 +0,0 @@
package main
import (
"encoding/yaml"
"alpha.dagger.io/dagger"
"alpha.dagger.io/kubernetes/kustomize"
)
TestKustomize: {
testdata: dagger.#Artifact
// Run Kustomize
kustom: kustomize.#Kustomize & {
source: testdata
kustomization: yaml.Marshal({
resources: ["deployment.yaml", "pod.yaml"]
images: [{
name: "nginx"
newTag: "v1"
}]
replicas: [{
name: "nginx-deployment"
count: 2
}]
})
}
// Verify kustomization generation
verify: #VerifyKustomize & {
source: kustom
}
}

View File

@@ -1,72 +0,0 @@
package main
import (
"alpha.dagger.io/dagger/op"
"alpha.dagger.io/dagger"
"alpha.dagger.io/alpine"
)
#VerifyKustomize: {
source: dagger.#Artifact
#up: [
op.#Load & {
from: alpine.#Image & {
package: bash: "=~5.1"
}
},
// Check files
op.#Exec & {
always: true
args: [
"sh", "-c", "test $(ls /source | wc -l) = 1",
]
mount: "/source": from: source
},
// Check image tag kustomization
op.#Exec & {
always: true
args: [
"sh", "-c", #"""
grep -q "\- image: nginx:v1" /source/result.yaml
"""#,
]
mount: "/source": from: source
},
// Check replicas kustomization
op.#Exec & {
always: true
args: [
"sh", "-c", #"""
grep -q "replicas: 2" /source/result.yaml
"""#,
]
mount: "/source": from: source
},
// Check pod merge by kustomization
op.#Exec & {
always: true
args: [
"sh", "-c", #"""
grep -q "kind: Pod" /source/result.yaml
"""#,
]
mount: "/source": from: source
},
// Check pod name
op.#Exec & {
always: true
args: [
"sh", "-c", #"""
grep -q "name: test-pod" /source/result.yaml
"""#,
]
mount: "/source": from: source
},
]
}

View File

@@ -1,10 +1,11 @@
plan:
module: .dagger/env/kubernetes-kustomize/plan
module: ./kubernetes/kustomize
package: ./tests
name: kubernetes-kustomize
inputs:
TestKustomize.testdata:
dir:
path: ./kubernetes/kustomize/testdata
path: ./kubernetes/kustomize/tests/testdata
sops:
kms: []
gcp_kms: []
@@ -20,8 +21,8 @@ sops:
OFllMEh3cVJZZnFxbW4xS1RtcFQzcFUKo/1WcYp4nPBXba8wQBe3DMt6pYQJGoSu
ja5BiCffN5wOoW9WT0j8Clx21w7BXcl46+T5GYpXDQDcqf6nCv1kYQ==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2021-06-17T20:48:00Z"
mac: ENC[AES256_GCM,data:SCWiSiDccPkZApOcc8RsYP7WPZUqUyYVB0UgivLhIsNSY5q3kCdenPLTUp2zLOcwaWzTPGmj++QtZjoNobcIhdVt1aJ9uXLLKRUXaRGIO3Jmhg3wj7kSPNjbDLZEB6uyA9h3edQGVVivNlNGpo91tg35QcFPPSG7UiowFnsD0zM=,iv:44hkujM/ZWjtYHau8BFMdOIeBj5jF/WnW4OOK7oSw1Y=,tag:mtJdUR+sA0tjIyAWDpXQlA==,type:str]
lastmodified: "2021-06-24T18:16:21Z"
mac: ENC[AES256_GCM,data:eq7Eev6taZJnkl2SoqihKo9tfAMA3IOnLO9tBoppUeg1LSLe6vZ8QmN7s1Z0gyWNWttnNTdMOvTQTI2PGrayQpLRGzryChcQsuCL7hnij6bQf16IcGn9jbq7NVQ1EreS8iPZYuyYlR5Z9kSARtfAKFALim8ccF+BmR9+X7yBfZ4=,iv:7kovyOERH0dx0NONhmUwOUI39nK5N1rT9o+gi9ol3f4=,tag:6HrkHbiCwrgO7hukxtsXVA==,type:str]
pgp: []
encrypted_suffix: secret
version: 3.7.1