Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Coredns
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Railgun
Coredns
Commits
5e999155
Commit
5e999155
authored
Aug 24, 2017
by
Sandeep Rajan
Committed by
Chris O'Haver
Aug 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Middleware/Kubernetes: Add RR check to K8s integration tests (#884)
parent
f901b0ce
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
506 additions
and
101 deletions
+506
-101
.travis.yml
.travis.yml
+2
-1
middleware/kubernetes/handler_test.go
middleware/kubernetes/handler_test.go
+2
-13
middleware/test/helpers.go
middleware/test/helpers.go
+18
-1
test/kubernetes_test.go
test/kubernetes_test.go
+484
-86
No files found.
.travis.yml
View file @
5e999155
...
@@ -25,7 +25,7 @@ env:
...
@@ -25,7 +25,7 @@ env:
# IPv6 is needed by some of the CoreDNS test cases. The VM environment
# IPv6 is needed by some of the CoreDNS test cases. The VM environment
# is needed to have access to sudo in the test environment. Sudo is
# is needed to have access to sudo in the test environment. Sudo is
# needed to have docker in the test environment. Docker is needed to
# needed to have docker in the test environment. Docker is needed to
# launch a
k
ubernetes instance in the test environment.
# launch a
K
ubernetes instance in the test environment.
# (Dependencies are fun! :) )
# (Dependencies are fun! :) )
before_install
:
before_install
:
-
cat /proc/net/if_inet6
-
cat /proc/net/if_inet6
...
@@ -51,5 +51,6 @@ before_script:
...
@@ -51,5 +51,6 @@ before_script:
script
:
script
:
-
make TEST_TYPE=$TEST_TYPE travis
-
make TEST_TYPE=$TEST_TYPE travis
after_success
:
after_success
:
-
bash <(curl -s https://codecov.io/bash)
-
bash <(curl -s https://codecov.io/bash)
middleware/kubernetes/handler_test.go
View file @
5e999155
...
@@ -235,19 +235,8 @@ func runServeDNSTests(ctx context.Context, t *testing.T, dnsTestCases map[string
...
@@ -235,19 +235,8 @@ func runServeDNSTests(ctx context.Context, t *testing.T, dnsTestCases map[string
}
}
// Before sorting, make sure that CNAMES do not appear after their target records
// Before sorting, make sure that CNAMES do not appear after their target records
for
i
,
c
:=
range
resp
.
Answer
{
test
.
CNAMEOrder
(
t
,
resp
)
if
c
.
Header
()
.
Rrtype
!=
dns
.
TypeCNAME
{
continue
}
for
_
,
a
:=
range
resp
.
Answer
[
:
i
]
{
if
a
.
Header
()
.
Name
!=
c
.
(
*
dns
.
CNAME
)
.
Target
{
continue
}
t
.
Errorf
(
"%v: CNAME found after target record
\n
"
,
testname
)
t
.
Logf
(
"%v Received:
\n
%v
\n
"
,
testname
,
resp
)
}
}
test
.
SortAndCheck
(
t
,
resp
,
tc
)
test
.
SortAndCheck
(
t
,
resp
,
tc
)
}
}
}
}
...
...
middleware/test/helpers.go
View file @
5e999155
...
@@ -13,7 +13,7 @@ type sect int
...
@@ -13,7 +13,7 @@ type sect int
const
(
const
(
// Answer is the answer section in an Msg.
// Answer is the answer section in an Msg.
Answer
sect
=
iota
Answer
sect
=
iota
// Ns is the auth
rot
itative section in an Msg.
// Ns is the auth
or
itative section in an Msg.
Ns
Ns
// Extra is the additional section in an Msg.
// Extra is the additional section in an Msg.
Extra
Extra
...
@@ -264,6 +264,23 @@ func Section(t *testing.T, tc Case, sec sect, rr []dns.RR) bool {
...
@@ -264,6 +264,23 @@ func Section(t *testing.T, tc Case, sec sect, rr []dns.RR) bool {
return
true
return
true
}
}
// CNAMEOrder makes sure that CNAMES do not appear after their target records
func
CNAMEOrder
(
t
*
testing
.
T
,
res
*
dns
.
Msg
)
{
for
i
,
c
:=
range
res
.
Answer
{
if
c
.
Header
()
.
Rrtype
!=
dns
.
TypeCNAME
{
continue
}
for
_
,
a
:=
range
res
.
Answer
[
:
i
]
{
if
a
.
Header
()
.
Name
!=
c
.
(
*
dns
.
CNAME
)
.
Target
{
continue
}
t
.
Errorf
(
"CNAME found after target record
\n
"
)
t
.
Logf
(
"%v
\n
"
,
res
)
}
}
}
// SortAndCheck sorts resp and the checks the header and three sections against the testcase in tc.
// SortAndCheck sorts resp and the checks the header and three sections against the testcase in tc.
func
SortAndCheck
(
t
*
testing
.
T
,
resp
*
dns
.
Msg
,
tc
Case
)
{
func
SortAndCheck
(
t
*
testing
.
T
,
resp
*
dns
.
Msg
,
tc
Case
)
{
sort
.
Sort
(
RRSet
(
resp
.
Answer
))
sort
.
Sort
(
RRSet
(
resp
.
Answer
))
...
...
test/kubernetes_test.go
View file @
5e999155
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