forked from vadimkim/cert-manager-webhook-hetzner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
42 lines (33 loc) · 930 Bytes
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"math/rand"
"os"
"testing"
"github.com/jetstack/cert-manager/test/acme/dns"
)
var (
zone = os.Getenv("TEST_ZONE_NAME")
fqdn string
)
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.
fqdn = GetRandomString(20) + "." + zone
fixture := dns.NewFixture(&hetznerDNSProviderSolver{},
dns.SetResolvedZone(zone),
dns.SetResolvedFQDN(fqdn),
dns.SetAllowAmbientCredentials(false),
dns.SetManifestPath("testdata/hetzner"),
dns.SetBinariesPath("kubebuilder/bin"),
)
fixture.RunConformance(t)
}
func GetRandomString(n int) string {
letters := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
b := make([]rune, n)
for i := range b {
b[i] = letters[rand.Intn(len(letters))]
}
return string(b)
}