chore: run e2e using go test

Signed-off-by: Tao Li <tao.li@enterprisedb.com>
This commit is contained in:
Tao Li 2026-08-21 19:17:48 +08:00
parent 6d0c1e2840
commit 674276f2ac
No known key found for this signature in database
GPG Key ID: 02D7CBDD527BEF02
2 changed files with 34 additions and 22 deletions

View File

@ -153,14 +153,16 @@ tasks:
DAGGER_GOLANGCI_LINT_SHA: ff27cd50f6b4eed2e3753c520632cd6099e1ce52 DAGGER_GOLANGCI_LINT_SHA: ff27cd50f6b4eed2e3753c520632cd6099e1ce52
# renovate: datasource=docker depName=golangci/golangci-lint versioning=docker # renovate: datasource=docker depName=golangci/golangci-lint versioning=docker
GOLANGCI_LINT_VERSION: v2.13.2 GOLANGCI_LINT_VERSION: v2.13.2
# renovate: datasource=docker depName=golang versioning=docker
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
internal: true internal: true
cmds: cmds:
- > - >
GITHUB_REF= dagger -sc "github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA} echo $(pwd);
--version ${GOLANGCI_LINT_VERSION} | GITHUB_REF= dagger -c "github.com/sagikazarmark/daggerverse/golangci-lint@${DAGGER_GOLANGCI_LINT_SHA}
--version ${GOLANGCI_LINT_VERSION}
--go-version ${GOLANG_IMAGE_VERSION} |
run . --config .golangci.yml | stdout" run . --config .golangci.yml | stdout"
sources:
- ./**/*.go
internal:wordlist-ordered: internal:wordlist-ordered:
desc: Order the word list file desc: Order the word list file
@ -208,7 +210,6 @@ tasks:
GITHUB_REF: main GITHUB_REF: main
GITHUB_REF_NAME: main GITHUB_REF_NAME: main
- documentation:apidoc - documentation:apidoc
- internal:wordlist-ordered
env: env:
# renovate: datasource=git-refs depName=uncommitted lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main # renovate: datasource=git-refs depName=uncommitted lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
DAGGER_UNCOMMITTED_SHA: 26cd57fb6ad66e88c036b675b0478d38df93962d DAGGER_UNCOMMITTED_SHA: 26cd57fb6ad66e88c036b675b0478d38df93962d
@ -225,11 +226,13 @@ tasks:
K8S_VERSION: 1.31.0 K8S_VERSION: 1.31.0
# renovate: datasource=git-refs depName=controller-runtime packageName=https://github.com/kubernetes-sigs/controller-runtime versioning=semver # renovate: datasource=git-refs depName=controller-runtime packageName=https://github.com/kubernetes-sigs/controller-runtime versioning=semver
SETUP_ENVTEST_VERSION: 0.24.1 SETUP_ENVTEST_VERSION: 0.24.1
# renovate: datasource=docker depName=golang versioning=docker
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
internal: true internal: true
cmds: cmds:
- > - >
GITHUB_REF= dagger -s call -m ./dagger/gotest GITHUB_REF= dagger -s call -m ./dagger/gotest
--go-version {{.GO_VERSION}} --go-version ${GOLANG_IMAGE_VERSION}
--kube-version ${K8S_VERSION} --kube-version ${K8S_VERSION}
--setup-envtest-version ${SETUP_ENVTEST_VERSION} --setup-envtest-version ${SETUP_ENVTEST_VERSION}
unit-test --src . unit-test --src .
@ -311,9 +314,14 @@ tasks:
internal: true internal: true
deps: deps:
- internal:registry-network-connect - internal:registry-network-connect
env:
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192
# renovate: datasource=docker depName=golang versioning=docker
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
cmds: cmds:
- > - >
dagger run docker buildx build -f containers/Dockerfile.plugin --build-arg GO_VERSION={{.GO_VERSION}} dagger run docker buildx build -f containers/Dockerfile.plugin --build-arg GO_VERSION=${GOLANG_IMAGE_VERSION}
--tag localhost:{{.REGISTRY_PORT}}/plugin-barman-cloud:testing --push . --tag localhost:{{.REGISTRY_PORT}}/plugin-barman-cloud:testing --push .
# We build an image and push it to a local registry. # We build an image and push it to a local registry.
@ -323,9 +331,14 @@ tasks:
internal: true internal: true
deps: deps:
- internal:registry-network-connect - internal:registry-network-connect
env:
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192
# renovate: datasource=docker depName=golang versioning=docker
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
cmds: cmds:
- > - >
dagger run docker buildx build -f containers/Dockerfile.sidecar --build-arg GO_VERSION={{.GO_VERSION}} dagger run docker buildx build -f containers/Dockerfile.sidecar --build-arg GO_VERSION=${GOLANG_IMAGE_VERSION}
--tag localhost:{{.REGISTRY_PORT}}/sidecar-barman-cloud:testing --push . --tag localhost:{{.REGISTRY_PORT}}/sidecar-barman-cloud:testing --push .
internal:publish: internal:publish:
@ -348,17 +361,19 @@ tasks:
env: env:
# renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main # renovate: datasource=git-refs depName=docker lookupName=https://github.com/purpleclay/daggerverse currentValue=main
DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192 DAGGER_DOCKER_SHA: ee12c1a4a2630e194ec20c5a9959183e3a78c192
# renovate: datasource=docker depName=golang versioning=docker
GOLANG_IMAGE_VERSION: 1.26.6@sha256:0d1d3a794be25f809dd2cb3160d8c73276c4056a9f8242a138e908ddeee7b6b6
internal: true internal: true
cmds: cmds:
- > - >
GITHUB_REF= dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA} GITHUB_REF= dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
--registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD --registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD
build --dir . --file containers/Dockerfile.plugin --args GO_VERSION={{.GO_VERSION}} --platform linux/amd64 --platform linux/arm64 build --dir . --file containers/Dockerfile.plugin --args GO_VERSION=${GOLANG_IMAGE_VERSION} --platform linux/amd64 --platform linux/arm64
publish --ref {{.PLUGIN_IMAGE_NAME}} --tags {{.IMAGE_VERSION}} publish --ref {{.PLUGIN_IMAGE_NAME}} --tags {{.IMAGE_VERSION}}
- > - >
GITHUB_REF= dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA} GITHUB_REF= dagger call -m github.com/purpleclay/daggerverse/docker@${DAGGER_DOCKER_SHA}
--registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD --registry ghcr.io --username $REGISTRY_USER --password env:REGISTRY_PASSWORD
build --dir . --file containers/Dockerfile.sidecar --args GO_VERSION={{.GO_VERSION}} --platform linux/amd64 --platform linux/arm64 build --dir . --file containers/Dockerfile.sidecar --args GO_VERSION=${GOLANG_IMAGE_VERSION} --platform linux/amd64 --platform linux/arm64
publish --ref {{.SIDECAR_IMAGE_NAME}} --tags {{.IMAGE_VERSION}} publish --ref {{.SIDECAR_IMAGE_NAME}} --tags {{.IMAGE_VERSION}}
internal:controller-gen: internal:controller-gen:
@ -440,7 +455,7 @@ tasks:
- internal:controller-gen - internal:controller-gen
env: env:
# renovate: datasource=git-refs depName=crd-gen-refs lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main # renovate: datasource=git-refs depName=crd-gen-refs lookupName=https://github.com/cloudnative-pg/daggerverse currentValue=main
DAGGER_CRDGENREF_SHA: 7174b66d283da487638a98b431b7707b311a9a32 DAGGER_CRDGENREF_SHA: 26cd57fb6ad66e88c036b675b0478d38df93962d
# renovate: datasource=go depName=github.com/elastic/crd-ref-docs # renovate: datasource=go depName=github.com/elastic/crd-ref-docs
CRDREFDOCS_VERSION: v0.3.0 CRDREFDOCS_VERSION: v0.3.0
cmds: cmds:
@ -538,8 +553,11 @@ tasks:
. .
- rm -f {{ .KUBECONFIG_PATH }} - rm -f {{ .KUBECONFIG_PATH }}
# Run e2e tests on the kind cluster specified by KIND_CLUSTER_NAME
integration:e2e: integration:e2e:
desc: Run the e2e tests desc: Run the e2e tests
summary: |
Run e2e against the Kind cluster specified by KIND_CLUSTER_NAME
deps: deps:
- integration:deploy-to-kind - integration:deploy-to-kind
run: once run: once
@ -555,14 +573,8 @@ tasks:
sh: docker inspect --format '{{"{{"}} (index (index .HostConfig.PortBindings "6443/tcp") 0).HostPort {{"}}"}}' {{ .KIND_CLUSTER_NAME }}-control-plane sh: docker inspect --format '{{"{{"}} (index (index .HostConfig.PortBindings "6443/tcp") 0).HostPort {{"}}"}}' {{ .KIND_CLUSTER_NAME }}-control-plane
cmds: cmds:
- kind get kubeconfig --name {{ .KIND_CLUSTER_NAME }} > {{ .KUBECONFIG_PATH }} - kind get kubeconfig --name {{ .KIND_CLUSTER_NAME }} > {{ .KUBECONFIG_PATH }}
# kind writes the external server address as https://127.0.0.1:<port>, which is only valid on - defer: rm -f {{ .KUBECONFIG_PATH }}
# the host. Rewrite it to the "kubernetes" alias that --svc below binds inside the dagger container.
- > - >
sed -i.bak "s#server: https://[^:]*:[0-9]*#server: https://kubernetes:{{ .KIND_HOSTPORT }}#" {{ .KUBECONFIG_PATH }} kubectl --kubeconfig={{.KUBECONFIG_PATH}} config set-cluster kind-{{.KIND_CLUSTER_NAME}}
- > --server=https://127.0.0.1:{{.KIND_HOSTPORT}} --insecure-skip-tls-verify=true
GITHUB_REF= dagger call -m dagger/e2e/ run - KUBECONFIG={{.KUBECONFIG_PATH}} go test ./test/e2e/... -v -ginkgo.v -timeout 45m
--source .
--kubeconfig {{.KUBECONFIG_PATH}}
--svc tcp://127.0.0.1:{{.KIND_HOSTPORT}}
--go-version {{.GO_VERSION}}
- rm -f {{ .KUBECONFIG_PATH }} {{ .KUBECONFIG_PATH }}.bak

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/cloudnative-pg/plugin-barman-cloud module github.com/cloudnative-pg/plugin-barman-cloud
go 1.26.4 go 1.26.6
require ( require (
github.com/cert-manager/cert-manager v1.21.1 github.com/cert-manager/cert-manager v1.21.1