Merge pull request #391 from marineam/go-1.5.1
Fix and enable testing on Go 1.5
This commit is contained in:
commit
05062188f1
@ -3,11 +3,10 @@ sudo: false
|
||||
matrix:
|
||||
include:
|
||||
- go: 1.4
|
||||
env: TOOLS_CMD=golang.org/x/tools/cmd
|
||||
|
||||
install:
|
||||
- go get ${TOOLS_CMD}/cover
|
||||
- go get ${TOOLS_CMD}/vet
|
||||
install:
|
||||
- go get golang.org/x/tools/cmd/cover
|
||||
- go get golang.org/x/tools/cmd/vet
|
||||
- go: 1.5
|
||||
|
||||
script:
|
||||
- ./test
|
||||
|
@ -52,6 +52,14 @@ func TestParseNameservers(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func mkInvalidMAC() error {
|
||||
if isGo15 {
|
||||
return &net.AddrError{Err: "invalid MAC address", Addr: "bad"}
|
||||
} else {
|
||||
return errors.New("invalid MAC address: bad")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseInterface(t *testing.T) {
|
||||
for _, tt := range []struct {
|
||||
cfg digitalocean.Interface
|
||||
@ -64,7 +72,7 @@ func TestParseInterface(t *testing.T) {
|
||||
cfg: digitalocean.Interface{
|
||||
MAC: "bad",
|
||||
},
|
||||
err: errors.New("invalid MAC address: bad"),
|
||||
err: mkInvalidMAC(),
|
||||
},
|
||||
{
|
||||
cfg: digitalocean.Interface{
|
||||
@ -337,13 +345,13 @@ func TestParseInterfaces(t *testing.T) {
|
||||
cfg: digitalocean.Interfaces{
|
||||
Public: []digitalocean.Interface{{MAC: "bad"}},
|
||||
},
|
||||
err: errors.New("invalid MAC address: bad"),
|
||||
err: mkInvalidMAC(),
|
||||
},
|
||||
{
|
||||
cfg: digitalocean.Interfaces{
|
||||
Private: []digitalocean.Interface{{MAC: "bad"}},
|
||||
},
|
||||
err: errors.New("invalid MAC address: bad"),
|
||||
err: mkInvalidMAC(),
|
||||
},
|
||||
} {
|
||||
ifaces, err := parseInterfaces(tt.cfg, tt.nss)
|
||||
|
5
network/is_go15_false_test.go
Normal file
5
network/is_go15_false_test.go
Normal file
@ -0,0 +1,5 @@
|
||||
// +build !go1.5
|
||||
|
||||
package network
|
||||
|
||||
const isGo15 = false
|
5
network/is_go15_true_test.go
Normal file
5
network/is_go15_true_test.go
Normal file
@ -0,0 +1,5 @@
|
||||
// +build go1.5
|
||||
|
||||
package network
|
||||
|
||||
const isGo15 = true
|
Loading…
x
Reference in New Issue
Block a user