aboutsummaryrefslogtreecommitdiff
path: root/lib/dns/dns_test.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-08-05 15:21:29 +0700
committerShulhan <ms@kilabit.info>2023-08-05 15:47:53 +0700
commit34d09fcaa210ddd9d8bf8d1754151faeebf4e485 (patch)
tree7346e07a168f65f81dd5475816bb1e88119f9a0f /lib/dns/dns_test.go
parentbd2ae82e254e203a021c9907e41b41ec0643ad49 (diff)
downloadpakakeh.go-34d09fcaa210ddd9d8bf8d1754151faeebf4e485.tar.xz
lib/dns: always initialize the Zone SOA record to default values
Previously, if we parse, create, or remove the SOA record from zone, we assume the SOA records are valid and not touch their values. In this changes, we set the SOA fields to default values if its not set, to make the SOA record consistent and valid, in perspective of client. This changes also export the default OS values for documentation and add new method NewRDataSOA to simplify creating new SOA record.
Diffstat (limited to 'lib/dns/dns_test.go')
-rw-r--r--lib/dns/dns_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/dns/dns_test.go b/lib/dns/dns_test.go
index 1d9bac6a..207b5a3c 100644
--- a/lib/dns/dns_test.go
+++ b/lib/dns/dns_test.go
@@ -15,6 +15,9 @@ const (
testServerAddress = "127.0.0.1:5300"
testDoTServerAddress = "127.0.0.1:18053"
testTLSPort = 18053
+
+ // Equal to 2023-08-05 07:53:20 +0000 UTC.
+ testNowEpoch = 1691222000
)
var (
@@ -24,6 +27,10 @@ var (
func TestMain(m *testing.M) {
log.SetFlags(0)
+ timeNow = func() time.Time {
+ return time.Unix(testNowEpoch, 0)
+ }
+
var (
serverOptions = &ServerOptions{
ListenAddress: "127.0.0.1:5300",