test: check formatting for all relevant packages in pkg/

This commit is contained in:
Anthony Romano 2016-03-30 12:37:08 -07:00
parent 0f64e01f6b
commit b539d3a411
7 changed files with 10 additions and 6 deletions

View File

@ -400,7 +400,7 @@ func (ivt *IntervalTree) MaxHeight() int {
return int((2 * math.Log2(float64(ivt.Len()+1))) + 0.5)
}
// InternalVisitor is used on tree searchs; return false to stop searching.
// IntervalVisitor is used on tree searchs; return false to stop searching.
type IntervalVisitor func(n *IntervalValue) bool
// Visit calls a visitor function on every tree node intersecting the given interval.

View File

@ -19,12 +19,13 @@ import (
"fmt"
"net/http"
"net/url"
"sort"
"strings"
)
type CORSInfo map[string]bool
// CORSInfo implements the flag.Value interface to allow users to define a list of CORS origins
// Set implements the flag.Value interface to allow users to define a list of CORS origins
func (ci *CORSInfo) Set(s string) error {
m := make(map[string]bool)
for _, v := range strings.Split(s, ",") {
@ -49,6 +50,7 @@ func (ci *CORSInfo) String() string {
for k := range *ci {
o = append(o, k)
}
sort.StringSlice(o).Sort()
return strings.Join(o, ",")
}

View File

@ -91,7 +91,7 @@ func TestCORSHandler(t *testing.T) {
return http.Header{
"Access-Control-Allow-Methods": []string{"POST, GET, OPTIONS, PUT, DELETE"},
"Access-Control-Allow-Origin": []string{origin},
"Access-Control-Allow-Headers": []string{"accept, content-type"},
"Access-Control-Allow-Headers": []string{"accept, content-type, authorization"},
}
}
tests := []struct {

View File

@ -28,7 +28,7 @@ func TestFIFOSchedule(t *testing.T) {
jobCreator := func(i int) Job {
return func(ctx context.Context) {
if next != i {
t.Fatalf("job#%d: got %d, want %d", next, i)
t.Fatalf("job#%d: got %d, want %d", i, next, i)
}
next = i + 1
}

View File

@ -22,6 +22,7 @@ import (
"time"
)
// WaitSchedule briefly sleeps in order to invoke the go scheduler.
// TODO: improve this when we are able to know the schedule or status of target go-routine.
func WaitSchedule() {
time.Sleep(10 * time.Millisecond)

View File

@ -98,7 +98,7 @@ func TestParse(t *testing.T) {
}
}
// This is only tested in Go1.5+ because Go1.4 doesn't support literal IPv6 address with zone in
// TestNewURLsMapIPV6 is only tested in Go1.5+ because Go1.4 doesn't support literal IPv6 address with zone in
// URI (https://github.com/golang/go/issues/6530).
func TestNewURLsMapIPV6(t *testing.T) {
c, err := NewURLsMap("mem1=http://[2001:db8::1]:2380,mem1=http://[fe80::6e40:8ff:feb1:58e4%25en0]:2380,mem2=http://[fe80::92e2:baff:fe7c:3224%25ext0]:2380")

3
test
View File

@ -17,7 +17,8 @@ GO_BUILD_FLAGS=-a
source ./build
# Hack: gofmt ./ will recursively check the .git directory. So use *.go for gofmt.
TESTABLE_AND_FORMATTABLE="client clientv3 discovery error etcdctl/ctlv2 etcdctl/ctlv3 etcdmain etcdserver etcdserver/auth etcdserver/etcdhttp etcdserver/etcdhttp/httptypes pkg/fileutil pkg/flags pkg/idutil pkg/ioutil pkg/netutil pkg/osutil pkg/pbutil pkg/types pkg/transport pkg/wait proxy raft snap storage storage/backend store version wal"
PKGS=`ls pkg/*/*go | cut -f1,2 -d/ | sort | uniq`
TESTABLE_AND_FORMATTABLE="client clientv3 discovery error etcdctl/ctlv2 etcdctl/ctlv3 etcdmain etcdserver etcdserver/auth etcdserver/etcdhttp etcdserver/etcdhttp/httptypes $PKGS proxy raft snap storage storage/backend store version wal"
# TODO: add it to race testing when the issue is resolved
# https://github.com/golang/go/issues/9946
NO_RACE_TESTABLE="rafthttp"