kubernetes/migration: Remove all deps (#178)

* remove diff and deps

* remove caddy deps, copy stuff locally
This commit is contained in:
Chris O'Haver 2019-05-30 17:58:30 -04:00 committed by GitHub
parent fd33b6aa56
commit d9e12ec6f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 463 additions and 93 deletions

View file

@ -1,8 +1,9 @@
package corefile
import (
"github.com/mholt/caddy"
"strings"
"github.com/coredns/deployment/kubernetes/migration/caddy"
)
type Corefile struct {
@ -27,7 +28,7 @@ type Option struct {
func New(s string) (*Corefile, error) {
c := Corefile{}
cc := caddy.NewTestController("migration", s)
cc := caddy.NewDispenser("migration", strings.NewReader(s))
depth := 0
var cSvr *Server
var cPlg *Plugin

View file

@ -40,9 +40,9 @@ func TestCorefile(t *testing.T) {
}
func TestServer_FindMatch(t *testing.T) {
tests := []struct{
tests := []struct {
server *Server
match bool
match bool
}{
{server: &Server{DomPorts: []string{".:53"}}, match: true},
{server: &Server{DomPorts: []string{".:54"}}, match: false},
@ -67,16 +67,16 @@ func TestServer_FindMatch(t *testing.T) {
}
func TestPlugin_FindMatch(t *testing.T) {
tests := []struct{
tests := []struct {
plugin *Plugin
match bool
match bool
}{
{plugin: &Plugin{Name: "plugin1", Args: []string{}}, match: true},
{plugin: &Plugin{Name: "plugin2", Args: []string{"1","1.5","2"}}, match: true},
{plugin: &Plugin{Name: "plugin3", Args: []string{"1","2","3","4"}}, match: true},
{plugin: &Plugin{Name: "plugin2", Args: []string{"1", "1.5", "2"}}, match: true},
{plugin: &Plugin{Name: "plugin3", Args: []string{"1", "2", "3", "4"}}, match: true},
{plugin: &Plugin{Name: "plugin1", Args: []string{"a"}}, match: false},
{plugin: &Plugin{Name: "plugin2", Args: []string{"1","1.5","b"}}, match: false},
{plugin: &Plugin{Name: "plugin3", Args: []string{"a","2","3","4"}}, match: false},
{plugin: &Plugin{Name: "plugin2", Args: []string{"1", "1.5", "b"}}, match: false},
{plugin: &Plugin{Name: "plugin3", Args: []string{"a", "2", "3", "4"}}, match: false},
{plugin: &Plugin{Name: "plugin4", Args: []string{}}, match: false},
}
@ -94,16 +94,16 @@ func TestPlugin_FindMatch(t *testing.T) {
}
func TestOption_FindMatch(t *testing.T) {
tests := []struct{
tests := []struct {
option *Plugin
match bool
match bool
}{
{option: &Plugin{Name: "option1", Args: []string{}}, match: true},
{option: &Plugin{Name: "option2", Args: []string{"1","1.5","2"}}, match: true},
{option: &Plugin{Name: "option3", Args: []string{"1","2","3","4"}}, match: true},
{option: &Plugin{Name: "option2", Args: []string{"1", "1.5", "2"}}, match: true},
{option: &Plugin{Name: "option3", Args: []string{"1", "2", "3", "4"}}, match: true},
{option: &Plugin{Name: "option1", Args: []string{"a"}}, match: false},
{option: &Plugin{Name: "option2", Args: []string{"1","1.5","b"}}, match: false},
{option: &Plugin{Name: "option3", Args: []string{"a","2","3","4"}}, match: false},
{option: &Plugin{Name: "option2", Args: []string{"1", "1.5", "b"}}, match: false},
{option: &Plugin{Name: "option3", Args: []string{"a", "2", "3", "4"}}, match: false},
{option: &Plugin{Name: "option4", Args: []string{}}, match: false},
}
@ -118,4 +118,4 @@ func TestOption_FindMatch(t *testing.T) {
t.Errorf("In test #%v, expected match to be %v but got %v.", i, test.match, match)
}
}
}
}