Skip to content

Commit

Permalink
fix tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
menghanl committed Sep 15, 2017
1 parent 1691e11 commit 8906133
Showing 1 changed file with 28 additions and 56 deletions.
84 changes: 28 additions & 56 deletions pickfirst_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,12 @@ import (

func TestOneBackendPickfirst(t *testing.T) {
defer leakcheck.Check(t)
r, cleanup := manual.GenerateAndRegisterManualResolver()
defer cleanup()
r, rcleanup := manual.GenerateAndRegisterManualResolver()
defer rcleanup()

numServers := 1
servers, _ := startServers(t, numServers, math.MaxInt32)
defer func() {
for i := 0; i < numServers; i++ {
servers[i].stop()
}
}()
servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
defer scleanup()

cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithBalancerBuilder(newPickfirstBuilder()), WithCodec(testCodec{}))
if err != nil {
Expand Down Expand Up @@ -71,16 +67,12 @@ func TestOneBackendPickfirst(t *testing.T) {

func TestBackendsPickfirst(t *testing.T) {
defer leakcheck.Check(t)
r, cleanup := manual.GenerateAndRegisterManualResolver()
defer cleanup()
r, rcleanup := manual.GenerateAndRegisterManualResolver()
defer rcleanup()

numServers := 2
servers, _ := startServers(t, numServers, math.MaxInt32)
defer func() {
for i := 0; i < numServers; i++ {
servers[i].stop()
}
}()
servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
defer scleanup()

cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithBalancerBuilder(newPickfirstBuilder()), WithCodec(testCodec{}))
if err != nil {
Expand Down Expand Up @@ -109,16 +101,12 @@ func TestBackendsPickfirst(t *testing.T) {

func TestNewAddressWhileBlockingPickfirst(t *testing.T) {
defer leakcheck.Check(t)
r, cleanup := manual.GenerateAndRegisterManualResolver()
defer cleanup()
r, rcleanup := manual.GenerateAndRegisterManualResolver()
defer rcleanup()

numServers := 1
servers, _ := startServers(t, numServers, math.MaxInt32)
defer func() {
for i := 0; i < numServers; i++ {
servers[i].stop()
}
}()
servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
defer scleanup()

cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithBalancerBuilder(newPickfirstBuilder()), WithCodec(testCodec{}))
if err != nil {
Expand Down Expand Up @@ -150,16 +138,12 @@ func TestNewAddressWhileBlockingPickfirst(t *testing.T) {

func TestCloseWithPendingRPCPickfirst(t *testing.T) {
defer leakcheck.Check(t)
r, cleanup := manual.GenerateAndRegisterManualResolver()
defer cleanup()
r, rcleanup := manual.GenerateAndRegisterManualResolver()
defer rcleanup()

numServers := 1
servers, _ := startServers(t, numServers, math.MaxInt32)
defer func() {
for i := 0; i < numServers; i++ {
servers[i].stop()
}
}()
_, _, scleanup := startServers(t, numServers, math.MaxInt32)
defer scleanup()

cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithBalancerBuilder(newPickfirstBuilder()), WithCodec(testCodec{}))
if err != nil {
Expand Down Expand Up @@ -191,16 +175,12 @@ func TestCloseWithPendingRPCPickfirst(t *testing.T) {

func TestOneServerDownPickfirst(t *testing.T) {
defer leakcheck.Check(t)
r, cleanup := manual.GenerateAndRegisterManualResolver()
defer cleanup()
r, rcleanup := manual.GenerateAndRegisterManualResolver()
defer rcleanup()

numServers := 2
servers, _ := startServers(t, numServers, math.MaxInt32)
defer func() {
for i := 0; i < numServers; i++ {
servers[i].stop()
}
}()
servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
defer scleanup()

cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithBalancerBuilder(newPickfirstBuilder()), WithCodec(testCodec{}))
if err != nil {
Expand Down Expand Up @@ -237,16 +217,12 @@ func TestOneServerDownPickfirst(t *testing.T) {

func TestAllServersDownPickfirst(t *testing.T) {
defer leakcheck.Check(t)
r, cleanup := manual.GenerateAndRegisterManualResolver()
defer cleanup()
r, rcleanup := manual.GenerateAndRegisterManualResolver()
defer rcleanup()

numServers := 2
servers, _ := startServers(t, numServers, math.MaxInt32)
defer func() {
for i := 0; i < numServers; i++ {
servers[i].stop()
}
}()
servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
defer scleanup()

cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithBalancerBuilder(newPickfirstBuilder()), WithCodec(testCodec{}))
if err != nil {
Expand Down Expand Up @@ -285,16 +261,12 @@ func TestAllServersDownPickfirst(t *testing.T) {

func TestAddressesRemovedPickfirst(t *testing.T) {
defer leakcheck.Check(t)
r, cleanup := manual.GenerateAndRegisterManualResolver()
defer cleanup()
r, rcleanup := manual.GenerateAndRegisterManualResolver()
defer rcleanup()

numServers := 3
servers, _ := startServers(t, numServers, math.MaxInt32)
defer func() {
for i := 0; i < numServers; i++ {
servers[i].stop()
}
}()
servers, _, scleanup := startServers(t, numServers, math.MaxInt32)
defer scleanup()

cc, err := Dial(r.Scheme()+":///test.server", WithInsecure(), WithBalancerBuilder(newPickfirstBuilder()), WithCodec(testCodec{}))
if err != nil {
Expand Down

0 comments on commit 8906133

Please sign in to comment.