Commit 4f0b36e5 authored by Miek Gieben's avatar Miek Gieben Committed by GitHub

Extend presubmit to covert test and request (#1846)

Fix the casing *and* fix use of context as we were still referencing
the non-std lib context - no wondering how this could have worked...
parent 0df5eb98
...@@ -5,7 +5,7 @@ SYSTEM:= ...@@ -5,7 +5,7 @@ SYSTEM:=
CHECKS:=check godeps CHECKS:=check godeps
VERBOSE:=-v VERBOSE:=-v
GOPATH?=$(HOME)/go GOPATH?=$(HOME)/go
PRESUBMIT:=core coremain plugin PRESUBMIT:=core coremain plugin test request
all: coredns all: coredns
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
package request package request
import ( import (
"context"
"net" "net"
"strings" "strings"
"github.com/coredns/coredns/plugin/pkg/edns" "github.com/coredns/coredns/plugin/pkg/edns"
"github.com/miekg/dns" "github.com/miekg/dns"
"golang.org/x/net/context"
) )
// Request contains some connection state and is useful in plugin. // Request contains some connection state and is useful in plugin.
......
...@@ -14,7 +14,7 @@ func TestLookupCache(t *testing.T) { ...@@ -14,7 +14,7 @@ func TestLookupCache(t *testing.T) {
// Start auth. CoreDNS holding the auth zone. // Start auth. CoreDNS holding the auth zone.
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
......
...@@ -34,7 +34,7 @@ func TestLookupDS(t *testing.T) { ...@@ -34,7 +34,7 @@ func TestLookupDS(t *testing.T) {
t.Parallel() t.Parallel()
name, rm, err := TempFile(".", miekNL) name, rm, err := TempFile(".", miekNL)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
package test package test
import ( import (
"context"
"io/ioutil" "io/ioutil"
"log" "log"
"testing" "testing"
...@@ -13,7 +14,6 @@ import ( ...@@ -13,7 +14,6 @@ import (
"github.com/coredns/coredns/request" "github.com/coredns/coredns/request"
"github.com/miekg/dns" "github.com/miekg/dns"
"golang.org/x/net/context"
) )
// uses some stuff from etcd_tests.go // uses some stuff from etcd_tests.go
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
package test package test
import ( import (
"context"
"encoding/json" "encoding/json"
"io/ioutil" "io/ioutil"
"log" "log"
...@@ -17,7 +18,6 @@ import ( ...@@ -17,7 +18,6 @@ import (
etcdc "github.com/coreos/etcd/client" etcdc "github.com/coreos/etcd/client"
"github.com/miekg/dns" "github.com/miekg/dns"
"golang.org/x/net/context"
) )
func etcdPlugin() *etcd.Etcd { func etcdPlugin() *etcd.Etcd {
......
...@@ -36,7 +36,7 @@ func testExternalPluginCompile(t *testing.T) { ...@@ -36,7 +36,7 @@ func testExternalPluginCompile(t *testing.T) {
} }
if !strings.Contains(string(out), "dns.example") { if !strings.Contains(string(out), "dns.example") {
t.Fatal("dns.example plugin should be there") t.Fatal("Plugin dns.example should be there")
} }
} }
...@@ -44,7 +44,7 @@ func run(t *testing.T, c *exec.Cmd) ([]byte, error) { ...@@ -44,7 +44,7 @@ func run(t *testing.T, c *exec.Cmd) ([]byte, error) {
c.Dir = ".." c.Dir = ".."
out, err := c.Output() out, err := c.Output()
if err != nil { if err != nil {
return nil, fmt.Errorf("run: failed to run %s %s: %q", c.Args[0], c.Args[1], err) return nil, fmt.Errorf("Run: failed to run %s %s: %q", c.Args[0], c.Args[1], err)
} }
return out, nil return out, nil
......
...@@ -6,7 +6,7 @@ func TestTempFile(t *testing.T) { ...@@ -6,7 +6,7 @@ func TestTempFile(t *testing.T) {
t.Parallel() t.Parallel()
_, f, e := TempFile(".", "test") _, f, e := TempFile(".", "test")
if e != nil { if e != nil {
t.Fatalf("failed to create temp file: %s", e) t.Fatalf("Failed to create temp file: %s", e)
} }
defer f() defer f()
} }
package test package test
import ( import (
"context"
"io/ioutil" "io/ioutil"
"log" "log"
"testing" "testing"
"time" "time"
"github.com/miekg/dns" "github.com/miekg/dns"
"golang.org/x/net/context"
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/coredns/coredns/pb" "github.com/coredns/coredns/pb"
......
...@@ -15,7 +15,7 @@ func TestLookupBalanceRewriteCacheDnssec(t *testing.T) { ...@@ -15,7 +15,7 @@ func TestLookupBalanceRewriteCacheDnssec(t *testing.T) {
t.Parallel() t.Parallel()
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
rm1 := createKeyFile(t) rm1 := createKeyFile(t)
......
...@@ -17,7 +17,7 @@ func benchmarkLookupBalanceRewriteCache(b *testing.B) { ...@@ -17,7 +17,7 @@ func benchmarkLookupBalanceRewriteCache(b *testing.B) {
t := new(testing.T) t := new(testing.T)
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
......
...@@ -38,7 +38,7 @@ func TestProxyWithHTTPCheckOK(t *testing.T) { ...@@ -38,7 +38,7 @@ func TestProxyWithHTTPCheckOK(t *testing.T) {
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
......
...@@ -16,7 +16,7 @@ func TestLookupProxy(t *testing.T) { ...@@ -16,7 +16,7 @@ func TestLookupProxy(t *testing.T) {
t.Parallel() t.Parallel()
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
...@@ -55,7 +55,7 @@ func TestLookupDnsWithForcedTcp(t *testing.T) { ...@@ -55,7 +55,7 @@ func TestLookupDnsWithForcedTcp(t *testing.T) {
t.Parallel() t.Parallel()
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
...@@ -94,7 +94,7 @@ func BenchmarkProxyLookup(b *testing.B) { ...@@ -94,7 +94,7 @@ func BenchmarkProxyLookup(b *testing.B) {
t := new(testing.T) t := new(testing.T)
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to created zone: %s", err) t.Fatalf("Failed to created zone: %s", err)
} }
defer rm() defer rm()
...@@ -105,12 +105,12 @@ func BenchmarkProxyLookup(b *testing.B) { ...@@ -105,12 +105,12 @@ func BenchmarkProxyLookup(b *testing.B) {
i, err := CoreDNSServer(corefile) i, err := CoreDNSServer(corefile)
if err != nil { if err != nil {
t.Fatalf("could not get CoreDNS serving instance: %s", err) t.Fatalf("Could not get CoreDNS serving instance: %s", err)
} }
udp, _ := CoreDNSServerPorts(i, 0) udp, _ := CoreDNSServerPorts(i, 0)
if udp == "" { if udp == "" {
t.Fatalf("could not get udp listening port") t.Fatalf("Could not get udp listening port")
} }
defer i.Stop() defer i.Stop()
......
...@@ -40,7 +40,7 @@ func TestEmptySecondaryZone(t *testing.T) { ...@@ -40,7 +40,7 @@ func TestEmptySecondaryZone(t *testing.T) {
func TestSecondaryZoneTransfer(t *testing.T) { func TestSecondaryZoneTransfer(t *testing.T) {
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
......
...@@ -16,7 +16,7 @@ func TestLookupWildcard(t *testing.T) { ...@@ -16,7 +16,7 @@ func TestLookupWildcard(t *testing.T) {
t.Parallel() t.Parallel()
name, rm, err := test.TempFile(".", exampleOrg) name, rm, err := test.TempFile(".", exampleOrg)
if err != nil { if err != nil {
t.Fatalf("failed to create zone: %s", err) t.Fatalf("Failed to create zone: %s", err)
} }
defer rm() defer rm()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment