Add k8s tags to related tests (#1018)
, so that `make test` will pass by default. Also fixed several ineffassign and golint issues. Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
parent
6493858893
commit
4b14243e9b
7 changed files with 19 additions and 8 deletions
|
@ -65,9 +65,8 @@ func (d *Data) HostPort(addr string) error {
|
||||||
d.SocketFam = tap.SocketFamily_INET6
|
d.SocketFam = tap.SocketFamily_INET6
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
} else {
|
|
||||||
return errors.New("not an ip address")
|
|
||||||
}
|
}
|
||||||
|
return errors.New("not an ip address")
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoteAddr parses the information about the remote address into Data.
|
// RemoteAddr parses the information about the remote address into Data.
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
func sendOneTcp(tcp *TCP) error {
|
func sendOneTCP(tcp *TCP) error {
|
||||||
if _, err := tcp.Write([]byte("frame")); err != nil {
|
if _, err := tcp.Write([]byte("frame")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@ func sendOneTcp(tcp *TCP) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func TestTcp(t *testing.T) {
|
func TestTCP(t *testing.T) {
|
||||||
tcp := NewTCP("localhost:14000")
|
tcp := NewTCP("localhost:14000")
|
||||||
|
|
||||||
if err := sendOneTcp(tcp); err == nil {
|
if err := sendOneTCP(tcp); err == nil {
|
||||||
t.Fatal("Not listening but no error.")
|
t.Fatal("Not listening but no error.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ func TestTcp(t *testing.T) {
|
||||||
wait <- true
|
wait <- true
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err := sendOneTcp(tcp); err != nil {
|
if err := sendOneTCP(tcp); err != nil {
|
||||||
t.Fatalf("send one: %s", err)
|
t.Fatalf("send one: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ func TestTcp(t *testing.T) {
|
||||||
// TODO: When the server isn't responding according to the framestream protocol
|
// TODO: When the server isn't responding according to the framestream protocol
|
||||||
// the thread is blocked.
|
// the thread is blocked.
|
||||||
/*
|
/*
|
||||||
if err := sendOneTcp(tcp); err == nil {
|
if err := sendOneTCP(tcp); err == nil {
|
||||||
panic("must fail")
|
panic("must fail")
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -54,7 +54,7 @@ func TestTcp(t *testing.T) {
|
||||||
wait <- true
|
wait <- true
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if err := sendOneTcp(tcp); err != nil {
|
if err := sendOneTCP(tcp); err != nil {
|
||||||
t.Fatalf("send one: %s", err)
|
t.Fatalf("send one: %s", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@ func (k *Kubernetes) Federations(state request.Request, fname, fzone string) (ms
|
||||||
return msg.Service{}, err
|
return msg.Service{}, err
|
||||||
}
|
}
|
||||||
r, err := parseRequest(state)
|
r, err := parseRequest(state)
|
||||||
|
if err != nil {
|
||||||
|
return msg.Service{}, err
|
||||||
|
}
|
||||||
|
|
||||||
lz := node.Labels[LabelZone]
|
lz := node.Labels[LabelZone]
|
||||||
lr := node.Labels[LabelRegion]
|
lr := node.Labels[LabelRegion]
|
||||||
|
|
|
@ -42,6 +42,9 @@ func TestHealthReload(t *testing.T) {
|
||||||
t.Fatalf("Could not get health: %s", err)
|
t.Fatalf("Could not get health: %s", err)
|
||||||
}
|
}
|
||||||
body, err = ioutil.ReadAll(resp.Body)
|
body, err = ioutil.ReadAll(resp.Body)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Could not get resp.Body: %s", err)
|
||||||
|
}
|
||||||
if x := string(body); x != "OK" {
|
if x := string(body); x != "OK" {
|
||||||
t.Fatalf("Expect OK, got %s", x)
|
t.Fatalf("Expect OK, got %s", x)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build k8s
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build k8s
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// +build k8s
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue