mirror of
https://github.com/1f349/orchid.git
synced 2024-12-22 08:04:10 +00:00
Remove some debug logging and clean up the test code a bit
This commit is contained in:
parent
fdfdc6c716
commit
796b739aa1
@ -124,7 +124,6 @@ func setupPebbleTest(t *testing.T, serverTls *certgen.CertGen) *Service {
|
||||
assert.NoError(t, err)
|
||||
certRaw, err := io.ReadAll(res.Body)
|
||||
assert.NoError(t, err)
|
||||
fmt.Println("Cert:", string(certRaw))
|
||||
|
||||
certDir, err := os.MkdirTemp("", "orchid-certs")
|
||||
keyDir, err := os.MkdirTemp("", "orchid-keys")
|
||||
@ -185,18 +184,13 @@ func TestPebbleRenewal(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
fmt.Println("Database rows")
|
||||
fmt.Println("=============")
|
||||
query, err := service.db.Query("SELECT cert_id, domain from certificate_domains")
|
||||
assert.NoError(t, err)
|
||||
for query.Next() {
|
||||
var a uint64
|
||||
var b string
|
||||
assert.NoError(t, query.Scan(&a, &b))
|
||||
|
||||
fmt.Println(a, b)
|
||||
}
|
||||
fmt.Println("=============")
|
||||
|
||||
assert.NoError(t, service.renewalCheck())
|
||||
certFilePath := filepath.Join(service.certDir, "1.cert.pem")
|
||||
|
@ -56,40 +56,17 @@ func (f *fakeDnsProv) CleanUp(domain, _, keyAuth string) error {
|
||||
log.Printf("fakeDnsProv.CleanUp(%s TXT %s)\n", info.EffectiveFQDN, info.Value)
|
||||
return nil
|
||||
}
|
||||
func (f *fakeDnsProv) GetDnsAddrs() []string {
|
||||
fmt.Printf("Get dns addrs: %v\n", f.Addr)
|
||||
return []string{f.Addr}
|
||||
}
|
||||
func (f *fakeDnsProv) GetDnsAddrs() []string { return []string{f.Addr} }
|
||||
|
||||
func (f *fakeDnsProv) parseQuery(m *dns.Msg) {
|
||||
for _, q := range m.Question {
|
||||
switch q.Qtype {
|
||||
case dns.TypeSOA:
|
||||
log.Printf("Looking up %s SOA record\n", q.Name)
|
||||
n := q.Name
|
||||
for strings.Count(n, ".") > 3 {
|
||||
// find next subdomain separator and trim the fqdn
|
||||
ni := strings.IndexByte(n, '.')
|
||||
if ni <= 0 {
|
||||
break
|
||||
}
|
||||
n = n[ni+1:]
|
||||
}
|
||||
|
||||
// find an answer if possible
|
||||
if strings.Count(q.Name, ".") == 3 {
|
||||
rr, err := dns.NewRR(fmt.Sprintf("%s 32600 IN SOA %s %s 1687993787 86400 7200 4000000 11200", n, "ns.example.com.", "hostmaster.example.com."))
|
||||
if err == nil {
|
||||
m.Answer = append(m.Answer, rr)
|
||||
}
|
||||
}
|
||||
case dns.TypeTXT:
|
||||
log.Printf("Looking up %s TXT record\n", q.Name)
|
||||
txt := f.mTxt[q.Name]
|
||||
if txt != "" {
|
||||
rr, err := dns.NewRR(fmt.Sprintf("%s 32600 IN TXT \"%s\"", q.Name, txt))
|
||||
if err == nil {
|
||||
fmt.Println("response:", rr.String())
|
||||
m.Answer = append(m.Answer, rr)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user