Remove the equality test between the server started and the servers found,
it need only be a member of the set, which is already checked for.
Also, change the server name to be unique on the testing machine, just in
case multiple versions of this test are running.
Change-Id: If2638879cfd0a4d53bad4f32c31310e4bb8c4211
diff --git a/services/mounttable/lib/neighborhood_test.go b/services/mounttable/lib/neighborhood_test.go
index 4c5bbb3..725b41c 100644
--- a/services/mounttable/lib/neighborhood_test.go
+++ b/services/mounttable/lib/neighborhood_test.go
@@ -2,6 +2,7 @@
import (
"fmt"
+ "os"
"reflect"
"testing"
"time"
@@ -44,8 +45,12 @@
naming.JoinAddressName(estr, "suffix1"),
naming.JoinAddressName(estr, "suffix2"),
}
+
+ // Create a name for the server.
+ serverName := fmt.Sprintf("nhtest%d", os.Getpid())
+
// Add neighborhood server.
- nhd, err := NewLoopbackNeighborhoodServer("joeblow", addresses...)
+ nhd, err := NewLoopbackNeighborhoodServer(serverName, addresses...)
if err != nil {
boom(t, "Failed to create neighborhood server: %s\n", err)
}
@@ -60,25 +65,22 @@
names := doGlob(t, naming.JoinAddressName(estr, "//"), "*", id)
t.Logf("names %v", names)
for _, n := range names {
- if n == "joeblow" {
+ if n == serverName {
break L
}
}
time.Sleep(1 * time.Second)
}
- want, got := []string{"joeblow"}, doGlob(t, naming.JoinAddressName(estr, "//"), "*", id)
- if !reflect.DeepEqual(want, got) {
- t.Errorf("Unexpected Glob result want: %q, got: %q", want, got)
- }
- want, got = []string{""}, doGlob(t, naming.JoinAddressName(estr, "//joeblow"), "", id)
+ // Make sure we get back a root for the server.
+ want, got := []string{""}, doGlob(t, naming.JoinAddressName(estr, "//"+serverName), "", id)
if !reflect.DeepEqual(want, got) {
t.Errorf("Unexpected Glob result want: %q, got: %q", want, got)
}
// Make sure we can resolve through the neighborhood.
expectedSuffix := "a/b"
- objectPtr, err := mounttable.BindMountTable(naming.JoinAddressName(estr, "//joeblow"+"/"+expectedSuffix), quuxClient(id))
+ objectPtr, err := mounttable.BindMountTable(naming.JoinAddressName(estr, "//"+serverName+"/"+expectedSuffix), quuxClient(id))
if err != nil {
boom(t, "BindMountTable: %s", err)
}