mirror of
https://github.com/coredns/coredns.git
synced 2025-11-30 23:54:03 -05:00
Remove the word middleware (#1067)
* Rename middleware to plugin first pass; mostly used 'sed', few spots where I manually changed text. This still builds a coredns binary. * fmt error * Rename AddMiddleware to AddPlugin * Readd AddMiddleware to remain backwards compat
This commit is contained in:
47
plugin/health/health_test.go
Normal file
47
plugin/health/health_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package health
|
||||
|
||||
// TODO(miek): enable again if plugin gets health check.
|
||||
/*
|
||||
func TestHealth(t *testing.T) {
|
||||
h := health{Addr: ":0"}
|
||||
h.h = append(h.h, &erratic.Erratic{})
|
||||
|
||||
if err := h.Startup(); err != nil {
|
||||
t.Fatalf("Unable to startup the health server: %v", err)
|
||||
}
|
||||
defer h.Shutdown()
|
||||
|
||||
// Reconstruct the http address based on the port allocated by operating system.
|
||||
address := fmt.Sprintf("http://%s%s", h.ln.Addr().String(), path)
|
||||
|
||||
// Norhing set should be unhealthy
|
||||
response, err := http.Get(address)
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to query %s: %v", address, err)
|
||||
}
|
||||
if response.StatusCode != 503 {
|
||||
t.Errorf("Invalid status code: expecting '503', got '%d'", response.StatusCode)
|
||||
}
|
||||
response.Body.Close()
|
||||
|
||||
// Make healthy
|
||||
h.Poll()
|
||||
|
||||
response, err = http.Get(address)
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to query %s: %v", address, err)
|
||||
}
|
||||
if response.StatusCode != 200 {
|
||||
t.Errorf("Invalid status code: expecting '200', got '%d'", response.StatusCode)
|
||||
}
|
||||
content, err := ioutil.ReadAll(response.Body)
|
||||
if err != nil {
|
||||
t.Fatalf("Unable to get response body from %s: %v", address, err)
|
||||
}
|
||||
response.Body.Close()
|
||||
|
||||
if string(content) != ok {
|
||||
t.Errorf("Invalid response body: expecting 'OK', got '%s'", string(content))
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user