Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
origosys
External Dns
Commits
1260d7b4
Commit
1260d7b4
authored
5 years ago
by
xunpan
Browse files
Options
Download
Email Patches
Plain Diff
add test case for coredns-prefix
parent
984e7de3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
pkg/apis/externaldns/types_test.go
pkg/apis/externaldns/types_test.go
+5
-0
provider/coredns_test.go
provider/coredns_test.go
+26
-6
No files found.
pkg/apis/externaldns/types_test.go
View file @
1260d7b4
...
...
@@ -54,6 +54,7 @@ var (
AzureResourceGroup
:
""
,
CloudflareProxied
:
false
,
CloudflareZonesPerPage
:
50
,
CoreDNSPrefix
:
"/skydns/"
,
InfobloxGridHost
:
""
,
InfobloxWapiPort
:
443
,
InfobloxWapiUsername
:
"admin"
,
...
...
@@ -115,6 +116,7 @@ var (
AzureResourceGroup
:
"arg"
,
CloudflareProxied
:
true
,
CloudflareZonesPerPage
:
20
,
CoreDNSPrefix
:
"/coredns/"
,
InfobloxGridHost
:
"127.0.0.1"
,
InfobloxWapiPort
:
8443
,
InfobloxWapiUsername
:
"infoblox"
,
...
...
@@ -182,6 +184,7 @@ var (
AzureResourceGroup
:
""
,
CloudflareProxied
:
false
,
CloudflareZonesPerPage
:
50
,
CoreDNSPrefix
:
"/skydns/"
,
InfobloxGridHost
:
""
,
InfobloxWapiPort
:
443
,
InfobloxWapiUsername
:
"admin"
,
...
...
@@ -250,6 +253,7 @@ func TestParseFlags(t *testing.T) {
"--azure-resource-group=arg"
,
"--cloudflare-proxied"
,
"--cloudflare-zones-per-page=20"
,
"--coredns-prefix=/coredns/"
,
"--infoblox-grid-host=127.0.0.1"
,
"--infoblox-wapi-port=8443"
,
"--infoblox-wapi-username=infoblox"
,
...
...
@@ -325,6 +329,7 @@ func TestParseFlags(t *testing.T) {
"EXTERNAL_DNS_AZURE_RESOURCE_GROUP"
:
"arg"
,
"EXTERNAL_DNS_CLOUDFLARE_PROXIED"
:
"1"
,
"EXTERNAL_DNS_CLOUDFLARE_ZONES_PER_PAGE"
:
"20"
,
"EXTERNAL_DNS_COREDNS_PREFIX"
:
"/coredns/"
,
"EXTERNAL_DNS_INFOBLOX_GRID_HOST"
:
"127.0.0.1"
,
"EXTERNAL_DNS_INFOBLOX_WAPI_PORT"
:
"8443"
,
"EXTERNAL_DNS_INFOBLOX_WAPI_USERNAME"
:
"infoblox"
,
...
...
This diff is collapsed.
Click to expand it.
provider/coredns_test.go
View file @
1260d7b4
...
...
@@ -25,6 +25,8 @@ import (
"github.com/kubernetes-incubator/external-dns/plan"
)
const
defaultCoreDNSPrefix
=
"/skydns/"
type
fakeETCDClient
struct
{
services
map
[
string
]
*
Service
}
...
...
@@ -60,7 +62,10 @@ func TestAServiceTranslation(t *testing.T) {
"/skydns/com/example"
:
{
Host
:
expectedTarget
},
},
}
provider
:=
coreDNSProvider
{
client
:
client
}
provider
:=
coreDNSProvider
{
client
:
client
,
coreDNSPrefix
:
defaultCoreDNSPrefix
,
}
endpoints
,
err
:=
provider
.
Records
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -89,7 +94,10 @@ func TestCNAMEServiceTranslation(t *testing.T) {
"/skydns/com/example"
:
{
Host
:
expectedTarget
},
},
}
provider
:=
coreDNSProvider
{
client
:
client
}
provider
:=
coreDNSProvider
{
client
:
client
,
coreDNSPrefix
:
defaultCoreDNSPrefix
,
}
endpoints
,
err
:=
provider
.
Records
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -118,7 +126,10 @@ func TestTXTServiceTranslation(t *testing.T) {
"/skydns/com/example"
:
{
Text
:
expectedTarget
},
},
}
provider
:=
coreDNSProvider
{
client
:
client
}
provider
:=
coreDNSProvider
{
client
:
client
,
coreDNSPrefix
:
defaultCoreDNSPrefix
,
}
endpoints
,
err
:=
provider
.
Records
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -149,7 +160,10 @@ func TestAWithTXTServiceTranslation(t *testing.T) {
"/skydns/com/example"
:
{
Host
:
"1.2.3.4"
,
Text
:
"string"
},
},
}
provider
:=
coreDNSProvider
{
client
:
client
}
provider
:=
coreDNSProvider
{
client
:
client
,
coreDNSPrefix
:
defaultCoreDNSPrefix
,
}
endpoints
,
err
:=
provider
.
Records
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -188,7 +202,10 @@ func TestCNAMEWithTXTServiceTranslation(t *testing.T) {
"/skydns/com/example"
:
{
Host
:
"example.net"
,
Text
:
"string"
},
},
}
provider
:=
coreDNSProvider
{
client
:
client
}
provider
:=
coreDNSProvider
{
client
:
client
,
coreDNSPrefix
:
defaultCoreDNSPrefix
,
}
endpoints
,
err
:=
provider
.
Records
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
...
...
@@ -219,7 +236,10 @@ func TestCoreDNSApplyChanges(t *testing.T) {
client
:=
fakeETCDClient
{
map
[
string
]
*
Service
{},
}
coredns
:=
coreDNSProvider
{
client
:
client
}
coredns
:=
coreDNSProvider
{
client
:
client
,
coreDNSPrefix
:
defaultCoreDNSPrefix
,
}
changes1
:=
&
plan
.
Changes
{
Create
:
[]
*
endpoint
.
Endpoint
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment