接入DNS在线测试传播参数
This commit is contained in:
1 parent
e982f54607
commit
8c1471e8fe
7 files changed
+175
-20
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-acme/lego/v5/challenge"
|
||||
"github.com/go-acme/lego/v5/challenge/dns01"
|
||||
@@ -79,6 +80,22 @@ func TestTesterCreatesAndCleansChallengeRecord(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTesterUsesConfiguredPropagationSettings(t *testing.T) {
|
||||
provider := &fakeProvider{}
|
||||
tester := NewTesterWithResolverAndSettings(fakeFactory{provider: provider}, missingTXTResolver{}, 20*time.Millisecond, 5*time.Millisecond)
|
||||
started := time.Now()
|
||||
_, err := tester.Verify(context.Background(), Cloudflare, "example.com", map[string]string{"api_token": "secret-token"})
|
||||
if err == nil {
|
||||
t.Fatal("missing TXT record should fail")
|
||||
}
|
||||
if elapsed := time.Since(started); elapsed > time.Second {
|
||||
t.Fatalf("configured propagation timeout was ignored: %s", elapsed)
|
||||
}
|
||||
if !provider.cleaned {
|
||||
t.Fatal("failed propagation check should clean up the record")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTesterDoesNotCleanupWhenPresentFails(t *testing.T) {
|
||||
provider := &fakeProvider{presentErr: errors.New("拒绝访问")}
|
||||
tester := NewTester(fakeFactory{provider: provider})
|
||||
|
||||
Reference in new issue
Block a user