mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-14 03:18:38 +08:00
2f83aa9302
* Switched to v2 go.mod Also set GO111MODULE=on in build stuff to always use Go modules even when in GOPATH. * Ensure go.mod, go.sum, and vendor are up to date * Attempt to fix Azure pipelines * Add set -e to properly fail on exit (it didn't seem to be propagating properly before). * Set workingDirectory for GoFmt and GoGen (this might be why it fails unlike compile and unitests). * Another attempt to fix Azure Pipelines * Use the Go env template for all go-related jobs. * Completely fixed Azure Pipelines * Added a display name to GoFmt for consistency. * Fixed diffs for GoFmt and GoGen. * Show git status for checks. * Drop GOPATH for tests TODO: Do the same for integration tests. * Drop GOPATH for integration tests * Show more diffs * Regenerate provider support matrix This wasn't done in #590...
44 lines
1,017 B
Go
44 lines
1,017 B
Go
package gandi5
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/StackExchange/dnscontrol/v2/models"
|
|
)
|
|
|
|
func TestRecordsToNative_1(t *testing.T) {
|
|
var rcs = []*models.RecordConfig{{}}
|
|
rcs[0].SetLabelFromFQDN("foo.example.com", "example.com")
|
|
rcs[0].Type = "A"
|
|
rcs[0].SetTarget("1.2.3.4")
|
|
|
|
ns := recordsToNative(rcs, "example.com")
|
|
|
|
if len(ns) != 1 {
|
|
t.Errorf("len(ns) != 1; got=%v", len(ns))
|
|
}
|
|
if len(ns[0].RrsetValues) != 1 {
|
|
t.Errorf("len(ns[0].RrsetValues) != 1; got=%v", ns[0].RrsetValues)
|
|
}
|
|
|
|
}
|
|
|
|
func TestRecordsToNative_2(t *testing.T) {
|
|
var rcs = []*models.RecordConfig{{}, {}}
|
|
rcs[0].SetLabelFromFQDN("foo.example.com", "example.com")
|
|
rcs[0].Type = "A"
|
|
rcs[0].SetTarget("1.2.3.4")
|
|
rcs[1].SetLabelFromFQDN("foo.example.com", "example.com")
|
|
rcs[1].Type = "A"
|
|
rcs[1].SetTarget("5.6.7.8")
|
|
|
|
ns := recordsToNative(rcs, "example.com")
|
|
|
|
if len(ns) != 1 {
|
|
t.Errorf("len(ns) != 1; got=%v", len(ns))
|
|
}
|
|
if len(ns[0].RrsetValues) != 2 {
|
|
t.Errorf("len(ns[0].RrsetValues) != 2; got=%v", ns[0].RrsetValues)
|
|
}
|
|
|
|
}
|