Update argoCD test

Signed-off-by: Tom Chauveau <tom.chauveau@epitech.eu>
This commit is contained in:
Tom Chauveau 2021-09-09 13:03:07 +02:00 committed by Sam Alba
parent a73b34d096
commit 2a91ae1d80
5 changed files with 143 additions and 98 deletions

View File

@ -151,6 +151,17 @@ jobs:
aws --endpoint-url=http://localhost:4566 s3 mb s3://dagger-ci
aws --endpoint-url=http://localhost:4566 ecr create-repository --repository-name dagger-ci
- name: Setup ArgoCD infra
run: |
make install
dagger -w universe -e argocd-infra input text TestKubeconfig -f "$HOME"/.kube/config
dagger -w universe -e dagger-infra up
# Expose Argo API
kubectl port-forward svc/argocd-server -n argocd 8080:443 &
curl localhost:8080
continue-on-error: true
- name: Universe Test
run: |
make universe-test

View File

@ -2,8 +2,10 @@ plan:
package: ./argocd/tests
name: argocd
inputs:
TestConfig.argocdConfig.server:
text: localhost:8080
TestConfig.argocdConfig.token:
secret: ENC[AES256_GCM,data:N7hA,iv:7gqCkackbGFXXBmTI+7eKq5OWSWttOt33vr9IwvN6wQ=,tag:yoBj8vEQv3b9lQJg2Ht51w==,type:str]
secret: ENC[AES256_GCM,data:TC8wCWyJ+yTkAQXBLLioVDUm4YfkMMgHEzcxyRBr/uwOErEYAWDE539dahcPclQYW/Ds7UVQIv+PMS+43zXSqIv5lde842IhOEIZwemCGnWrGy2yBC566WCYPxU16k76MzslwhJrYGDi4GF4zlIyvtVO6AbviumZqGT+wAq4/Z6KZ2CQTDWNf42ise2orGNsBTj7jqpazLO34A+Wt9USW/cJrSqU+BtAjGkoLZW65iGJ8ui8RdADxw5/A0rkdJaoN4mnSUi7yARpcmTdQBdo33385csTxxqy8oWw7OR4itUfzzWKbOprQph/EeEtxMtPAuHOB/9As/6dvIGcynwxPjw=,iv:xAb0eF1lCmNoaE9Tzfnq2uLB647DK2Cat2BZTPn272s=,tag:D2mfkvEAzVi34y7WYSg7JQ==,type:str]
sops:
kms: []
gcp_kms: []
@ -19,8 +21,8 @@ sops:
WG5JdHlKYUlnZnZlMVNIRjczSld5ek0KF0z0UqtoGcYFFeOyMwIDAY1pyKosaOii
IVqsMSYfj4+vz7mRd8HoXoSiSnuc7mLJek/izsdZtYUTfD/QnTC71Q==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2021-08-16T14:41:25Z"
mac: ENC[AES256_GCM,data:IGmsWqxTDcWRjAgGQbQ5s5Ip1FrTj3ncqpWpdW/HXYp2DqA1SMQ1aH3whJ9JcxlBALWzc0jI4LXuPS+wxy5zrSC/Syp6bt3hYyo7DRsPMpPozm2q26hbGFPDAEXRF5K1+ZHRQ+DnuKecQJuQVz4UNZQg1HTsebnDgZ+D9OHMaek=,iv:AFWorUNhkwxR6R7ilttnJHuWeohsgHsc6NIZPtM3nr4=,tag:kXrm1i09+bvuFAaZqFvNKA==,type:str]
lastmodified: "2021-09-09T09:31:30Z"
mac: ENC[AES256_GCM,data:khUMYQdGj8qwNd7TZa2TPJIeOD9WjOn6LpNhqnZ2VZPOHWzre56MSytBS65h2bqgB5ljaYOM8qR8qc6UzSFhcNOBaAKofOYfuD1Zy6BcjNzNbJ9wvQE9qvT5o25VHsLk+fNhJt04wNdGdWjPuJNJrTTGLj82CXKCUPGyxvV72Pg=,iv:ut+MuwUELE+xu+I1G6NmqFrxu39++2pr96SHShQ5scI=,tag:5Fa6WPRo7R9UN5L7ankYzA==,type:str]
pgp: []
encrypted_suffix: secret
version: 3.7.1

View File

@ -1,19 +1,18 @@
package app
package argocd
import (
"alpha.dagger.io/argocd"
"alpha.dagger.io/dagger"
"alpha.dagger.io/os"
)
TestConfig: argocdConfig: argocd.#Config & {
version: "v2.0.5"
server: "dagger-example-argocd-server.tld"
token: dagger.#Secret & dagger.#Input
TestConfig: argocdConfig: #Config & {
version: dagger.#Input & {*"v2.0.5" | string}
server: dagger.#Input & {*"dagger-example-argocd-server.tld" | string}
token: dagger.#Input & {dagger.#Secret}
}
TestArgoCD2: os.#Container & {
image: argocd.#CLI & {
TestArgoCD: os.#Container & {
image: #CLI & {
config: TestConfig.argocdConfig
}
always: true
@ -22,3 +21,8 @@ TestArgoCD2: os.#Container & {
"""#
env: VERSION: TestConfig.argocdConfig.version
}
TestArgoCDStatus: #Status & {
config: TestConfig.argocdConfig
name: "test"
}

View File

@ -81,6 +81,17 @@ skip_unless_local_kube() {
fi
}
# Check if there is a local endpoint.
#
# This is necessary to do test with endpoint.
# Usage:
# skip_unless_endpoint_available "localhost:8080"
skip_unless_endpoint_available() {
local endpoint="$1"
curl "$endpoint"
}
# Cleanup local Localstack instances
setup_localstack() {
if [ "$(curl -s http://localhost:4566)" = '{"status": "running"}' ] && \

View File

@ -215,8 +215,25 @@ setup() {
#dagger -e azure-storage up
}
@test "argocd" {
skip "ArgoCD CI secrets not yet generated - Infra not implemented yet"
#dagger -e argocd up
skip_unless_local_kube
# Deploy argoCD infra
# dagger -e argocd-infra input text TestKubeconfig -f "$HOME"/.kube/config
#dagger -e argocd-infra up
# pid=$!
curl localhost:8080
# Kill Pid
#check_pid=$(pgrep "$pid")
#if [ "$pid" -eq "$check_pid" ]; then
# kill "$pid"
#fi
# skip "ArgoCD CI secrets not yet generated - Infra not implemented yet"
# dagger -e argocd input secret TestConfig.argocdConfig.token "$(kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d && echo)"
# dagger -e argocd up
# Kill forward
# >&2 echo "kill pid"
}