mirror of
https://github.com/go-acme/lego.git
synced 2024-12-23 01:07:23 +02:00
3cd3024561
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
36 lines
713 B
Go
36 lines
713 B
Go
package dns01
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
|
|
"github.com/miekg/dns"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_updateDomainWithCName_caseInsensitive(t *testing.T) {
|
|
qname := "_acme-challenge.uppercase-test.example.com."
|
|
cnameTarget := "_acme-challenge.uppercase-test.cname-target.example.com."
|
|
|
|
msg := &dns.Msg{
|
|
MsgHdr: dns.MsgHdr{
|
|
Authoritative: true,
|
|
},
|
|
Answer: []dns.RR{
|
|
&dns.CNAME{
|
|
Hdr: dns.RR_Header{
|
|
Name: strings.ToUpper(qname), // CNAME names are case-insensitive
|
|
Rrtype: dns.TypeCNAME,
|
|
Class: dns.ClassINET,
|
|
Ttl: 3600,
|
|
},
|
|
Target: cnameTarget,
|
|
},
|
|
},
|
|
}
|
|
|
|
fqdn := updateDomainWithCName(msg, qname)
|
|
|
|
assert.Equal(t, cnameTarget, fqdn)
|
|
}
|