Fix mixed indentation within tests (#3855)
Signed-off-by: Ambrose Chua <ambrose@chua.family>
This commit is contained in:
parent
74eabe90e0
commit
ed1f42cf56
31 changed files with 284 additions and 305 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue