* Make CoreDNS a server type plugin for Caddy Remove code we don't need and port all middleware over. Fix all tests and rework the documentation. Also make `go generate` build a caddy binary which we then copy into our directory. This means `go build`-builds remain working as-is. And new etc instances in each etcd test for better isolation. Fix more tests and rework test.Server with the newer support Caddy offers. Fix Makefile to support new mode of operation.
32 lines
621 B
Go
32 lines
621 B
Go
package pprof
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mholt/caddy"
|
|
)
|
|
|
|
func TestPProf(t *testing.T) {
|
|
tests := []struct {
|
|
input string
|
|
shouldErr bool
|
|
}{
|
|
{`pprof`, false},
|
|
{`pprof {}`, true},
|
|
{`pprof /foo`, true},
|
|
{`pprof {
|
|
a b
|
|
}`, true},
|
|
{`pprof
|
|
pprof`, true},
|
|
}
|
|
for i, test := range tests {
|
|
c := caddy.NewTestController("dns", test.input)
|
|
err := setup(c)
|
|
if test.shouldErr && err == nil {
|
|
t.Errorf("Test %v: Expected error but found nil", i)
|
|
} else if !test.shouldErr && err != nil {
|
|
t.Errorf("Test %v: Expected no error but found error: %v", i, err)
|
|
}
|
|
}
|
|
}
|