lego/e2e/dnschallenge/challenges_test.go
2026-03-11 17:02:07 +01:00

44 lines
1.1 KiB
Go

package dnschallenge
import (
"context"
"fmt"
"os"
"testing"
"github.com/go-acme/lego/v5/e2e/loader"
)
const caDirectory = "https://localhost:15000/dir"
var load = loader.EnvLoader{
PebbleOptions: &loader.CmdOption{
HealthCheckURL: caDirectory,
Args: []string{"-strict", "-config", "fixtures/pebble-config-dns.json", "-dnsserver", "localhost:8053"},
Env: []string{"PEBBLE_VA_NOSLEEP=1", "PEBBLE_WFE_NONCEREJECT=20"},
Dir: "../",
},
LegoOptions: []string{
"LEGO_CA_CERTIFICATES=../fixtures/certs/pebble.minica.pem",
"EXEC_PATH=../fixtures/update-dns.sh",
"EXEC_SEQUENCE_INTERVAL=5",
"LEGO_DEBUG_ACME_HTTP_CLIENT=1",
},
ChallSrv: &loader.CmdOption{
Args: []string{"-http01", ":5012", "-tlsalpn01", ":5011"},
},
}
func TestMain(m *testing.M) {
os.Exit(load.MainTest(context.Background(), m))
}
func TestDNSHelp(t *testing.T) {
output, err := load.RunLegoCombinedOutput(t.Context(), "dnshelp")
if err != nil {
fmt.Fprintf(os.Stderr, "%s\n", output)
t.Fatal(err)
}
fmt.Fprintf(os.Stdout, "%s\n", output)
}