tests: allow setting dnsname and acme challenge key for webhook integration tests
Signed-off-by: Jonathan Simon Prates <jonathan.simonprates@gmail.com>
This commit is contained in:
parent
51340d0c87
commit
466ffe336d
@ -62,6 +62,16 @@ type fixture struct {
|
||||
// Default: 8.8.8.8:53
|
||||
testDNSServer string
|
||||
|
||||
// dnsName is the domain name used in the request in tests.
|
||||
// This field can be set using the SetDNSName Option.
|
||||
// Default: "example.com"
|
||||
dnsName string
|
||||
|
||||
// dnsChallengeKey is the value of TXT record in tests.
|
||||
// This field can be set using the SetDNSChallengeKey Option.
|
||||
// Default: "123d=="
|
||||
dnsChallengeKey string
|
||||
|
||||
// controlPlane is a reference to the control plane that is used to run the
|
||||
// test suite.
|
||||
// It is constructed when a Run* method is called.
|
||||
|
||||
@ -52,6 +52,12 @@ func applyDefaults(f *fixture) {
|
||||
if f.resolvedFQDN == "" {
|
||||
f.resolvedFQDN = "cert-manager-dns01-tests." + f.resolvedZone
|
||||
}
|
||||
if f.dnsName == "" {
|
||||
f.dnsName = "example.com"
|
||||
}
|
||||
if f.dnsChallengeKey == "" {
|
||||
f.dnsChallengeKey = "123d=="
|
||||
}
|
||||
runfiles := os.Getenv("TEST_SRCDIR")
|
||||
if f.binariesPath == "" {
|
||||
if runfiles != "" {
|
||||
@ -170,3 +176,18 @@ func SetPropagationLimit(d time.Duration) Option {
|
||||
f.propagationLimit = d
|
||||
}
|
||||
}
|
||||
|
||||
// SetDNSChallengeKey defines the value of the acme challenge string.
|
||||
func SetDNSChallengeKey(s string) Option {
|
||||
return func(f *fixture) {
|
||||
f.dnsChallengeKey = s
|
||||
}
|
||||
}
|
||||
|
||||
// SetDNSName defines the domain name to be used in the webhook
|
||||
// integration tests.
|
||||
func SetDNSName(s string) Option {
|
||||
return func(f *fixture) {
|
||||
f.dnsName = s
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,9 +87,8 @@ func (f *fixture) buildChallengeRequest(t *testing.T, ns string) *whapi.Challeng
|
||||
ResolvedZone: f.resolvedZone,
|
||||
AllowAmbientCredentials: f.allowAmbientCredentials,
|
||||
Config: f.jsonConfig,
|
||||
// TODO
|
||||
DNSName: "example.com",
|
||||
Key: "123d==",
|
||||
DNSName: f.dnsName,
|
||||
Key: f.dnsChallengeKey,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user