Added testing

This commit is contained in:
Chris Stuurman 2024-03-26 19:35:25 +02:00
parent 6869fdc80f
commit 0e5f75d700
5 changed files with 74 additions and 1 deletions

View File

@ -3,3 +3,4 @@ appVersion: "v0.0.1"
description: Cert-Manager webhook for sthome
name: sthome-webhook
version: 0.0.1

View File

@ -8,9 +8,25 @@
# here is recommended.
groupName: acme.sthome.net
labels: sthome-webhook
certManager:
namespace: ix-cert-manager
serviceAccountName: cert-manager
serviceAccountName: cert-manager-certmanager
#secrets:
# apiID:
# apiToken:
clusterIssuer:
enabled: true
staging: false
#email:
# https://cert-manager.io/docs/configuration/acme/#adding-multiple-solver-types
#selector:
# dnsZones:
# - 'sthome.net'
image:
repository: stuurmcp/cert-manager-webhook-sthome

38
tests/suite_test.go Normal file
View File

@ -0,0 +1,38 @@
//go:build integration
// +build integration
package tests
import (
"os"
"testing"
"github.com/cert-manager/cert-manager/test/acme/dns"
sthome "github.com/cert-manager/cert-manager-webhook-sthome/sthome"
)
var (
zone = os.Getenv("TEST_ZONE_NAME")
)
func TestRunsSuite(t *testing.T) {
// The manifest path should contain a file named config.json that is a
// snippet of valid configuration that should be included on the
// ChallengeRequest passed as part of the test cases.
currentDir, err := os.Getwd()
if err != nil {
t.Fatalf("error getting current working dir: %s", err.Error())
}
fixture := dns.NewFixture(&sthome.ProviderSolver{},
dns.SetResolvedZone(zone),
dns.SetAllowAmbientCredentials(true),
dns.SetBinariesPath(currentDir+"/kubebuilder/bin"),
dns.SetManifestPath(currentDir+"/testdata"),
dns.SetStrict(true),
)
fixture.RunConformance(t)
}

10
tests/testdata/config.json vendored Normal file
View File

@ -0,0 +1,10 @@
{
"accessKeySecretRef": {
"name": "sthome-secret",
"key": "STHOME_ACCESS_KEY"
},
"secretKeySecretRef": {
"name": "sthome-secret",
"key": "STHOME_SECRET_KEY"
}
}

8
tests/testdata/secret.yaml vendored Normal file
View File

@ -0,0 +1,8 @@
apiVersion: v1
stringData:
STHOME_ACCESS_KEY: STHOMEXXXXXXXXXXXXXX
STHOME_SECRET_KEY: 66666666-7777-8888-9999-000000000000
kind: Secret
metadata:
name: sthome-secret
type: Opaque