aboutsummaryrefslogtreecommitdiff
path: root/test/reload_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/reload_test.go')
-rw-r--r--test/reload_test.go52
1 files changed, 25 insertions, 27 deletions
diff --git a/test/reload_test.go b/test/reload_test.go
index 72f0a2dfd..697511e2e 100644
--- a/test/reload_test.go
+++ b/test/reload_test.go
@@ -14,9 +14,9 @@ import (
func TestReload(t *testing.T) {
corefile := `.:0 {
- whoami
-}
-`
+ whoami
+ }`
+
coreInput := NewInput(corefile)
c, err := CoreDNSServer(corefile)
@@ -60,11 +60,11 @@ func send(t *testing.T, server string) {
}
func TestReloadHealth(t *testing.T) {
- corefile := `
-.:0 {
- health 127.0.0.1:52182
- whoami
-}`
+ corefile := `.:0 {
+ health 127.0.0.1:52182
+ whoami
+ }`
+
c, err := CoreDNSServer(corefile)
if err != nil {
if strings.Contains(err.Error(), inUse) {
@@ -81,12 +81,12 @@ func TestReloadHealth(t *testing.T) {
}
func TestReloadMetricsHealth(t *testing.T) {
- corefile := `
-.:0 {
- prometheus 127.0.0.1:53183
- health 127.0.0.1:53184
- whoami
-}`
+ corefile := `.:0 {
+ prometheus 127.0.0.1:53183
+ health 127.0.0.1:53184
+ whoami
+ }`
+
c, err := CoreDNSServer(corefile)
if err != nil {
if strings.Contains(err.Error(), inUse) {
@@ -154,15 +154,14 @@ func TestReloadSeveralTimeMetrics(t *testing.T) {
// that is not used in another test
promAddress := "127.0.0.1:53185"
proc := "coredns_build_info"
- corefileWithMetrics := `
- .:0 {
+ corefileWithMetrics := `.:0 {
prometheus ` + promAddress + `
whoami
}`
- corefileWithoutMetrics := `
- .:0 {
+ corefileWithoutMetrics := `.:0 {
whoami
}`
+
if err := collectMetricsInfo(promAddress, proc); err == nil {
t.Errorf("Prometheus is listening before the test started")
}
@@ -211,14 +210,14 @@ func TestMetricsAvailableAfterReload(t *testing.T) {
procMetric := "coredns_build_info"
procCache := "coredns_cache_entries"
procForward := "coredns_dns_request_duration_seconds"
- corefileWithMetrics := `
- .:0 {
+ corefileWithMetrics := `.:0 {
prometheus ` + promAddress + `
cache
forward . 8.8.8.8 {
- force_tcp
+ force_tcp
}
}`
+
inst, _, tcp, err := CoreDNSServerAndPorts(corefileWithMetrics)
if err != nil {
if strings.Contains(err.Error(), inUse) {
@@ -265,23 +264,22 @@ func TestMetricsAvailableAfterReloadAndFailedReload(t *testing.T) {
procMetric := "coredns_build_info"
procCache := "coredns_cache_entries"
procForward := "coredns_dns_request_duration_seconds"
- corefileWithMetrics := `
- .:0 {
+ corefileWithMetrics := `.:0 {
prometheus ` + promAddress + `
cache
forward . 8.8.8.8 {
- force_tcp
+ force_tcp
}
}`
- invalidCorefileWithMetrics := `
- .:0 {
+ invalidCorefileWithMetrics := `.:0 {
prometheus ` + promAddress + `
cache
forward . 8.8.8.8 {
- force_tcp
+ force_tcp
}
invalid
}`
+
inst, _, tcp, err := CoreDNSServerAndPorts(corefileWithMetrics)
if err != nil {
if strings.Contains(err.Error(), inUse) {