Skip to content

Commit

Permalink
test: Use crc.dev records for DNS tests
Browse files Browse the repository at this point in the history
test/basic_test.go has some DNS resolution tests for various types of
DNS records. These tests use wikipedia.org or google.com, which means
they have to be updated once in a while when the admins of these sites
decide to change these records.
Lately this has happened a few times with wikipedia SRV and MX record.
This commit switches to crc.dev for these tests, as it's a domain we
control, and thus we have more control over DNS record changes.

Signed-off-by: Christophe Fergeau <cfergeau@redhat.com>
  • Loading branch information
cfergeau committed Aug 22, 2024
1 parent d909c79 commit 8f02adf
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions test/basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,26 +53,26 @@ var _ = ginkgo.Describe("dns", func() {
gomega.Expect(string(out)).To(gomega.ContainSubstring("Address: 52.200.142.250"))
})

ginkgo.It("should resolve CNAME record for www.wikipedia.org", func() {
out, err := sshExec("nslookup -query=cname www.wikipedia.org")
ginkgo.It("should resolve CNAME record for docs.crc.dev", func() {
out, err := sshExec("nslookup -query=cname docs.crc.dev")
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
gomega.Expect(string(out)).To(gomega.ContainSubstring("www.wikipedia.org canonical name = dyna.wikimedia.org."))
gomega.Expect(string(out)).To(gomega.ContainSubstring("docs.crc.dev canonical name = webredir.gandi.net."))
})
ginkgo.It("should resolve MX record for wikipedia.org", func() {
out, err := sshExec("nslookup -query=mx wikipedia.org")
ginkgo.It("should resolve MX record for crc.dev", func() {
out, err := sshExec("nslookup -query=mx crc.dev")
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
gomega.Expect(string(out)).To(gomega.ContainSubstring("wikipedia.org mail exchanger = 10 mx1001.wikimedia.org."))
gomega.Expect(string(out)).To(gomega.ContainSubstring("crc.dev mail exchanger = 10 spool.mail.gandi.net."))
})

ginkgo.It("should resolve NS record for wikipedia.org", func() {
out, err := sshExec("nslookup -query=ns wikipedia.org")
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
gomega.Expect(string(out)).To(gomega.ContainSubstring("wikipedia.org nameserver = ns0.wikimedia.org."))
})
ginkgo.It("should resolve LDAP SRV record for google.com", func() {
out, err := sshExec("nslookup -query=srv _ldap._tcp.google.com 8.8.8.8")
ginkgo.It("should resolve IMAPS SRV record for crc.dev", func() {
out, err := sshExec("nslookup -query=srv _imaps._tcp.crc.dev")
gomega.Expect(err).ShouldNot(gomega.HaveOccurred())
gomega.Expect(string(out)).To(gomega.ContainSubstring(`_ldap._tcp.google.com service = 5 0 389 ldap.google.com.`))
gomega.Expect(string(out)).To(gomega.ContainSubstring(`_imaps._tcp.crc.dev service = 0 1 993 mail.gandi.net.`))
})
ginkgo.It("should resolve TXT for crc.dev", func() {
out, err := sshExec("nslookup -query=txt crc.dev")
Expand Down

0 comments on commit 8f02adf

Please sign in to comment.