discovery/mojo: enable global discovery test
Fix a global discovery test failure by using local ip address
for a local mounttable server in testing.
Change-Id: Id2a4cfb81bee8818c9ed422c222d0b2edced060e
diff --git a/go/src/v.io/mojo/discovery/apptest/apptest.go b/go/src/v.io/mojo/discovery/apptest/apptest.go
index 63c8743..7d78079 100644
--- a/go/src/v.io/mojo/discovery/apptest/apptest.go
+++ b/go/src/v.io/mojo/discovery/apptest/apptest.go
@@ -19,8 +19,7 @@
func RunAppTests(mctx application.Context) int {
apptests := []func(*testing.T, application.Context){
AppTestDiscoveryBasic,
- // TODO(jhahn): Temporarily disable until fixing it.
- // AppTestGlobalDiscoveryBasic,
+ AppTestGlobalDiscoveryBasic,
}
var tests []testing.InternalTest
diff --git a/go/src/v.io/mojo/discovery/discovery.go b/go/src/v.io/mojo/discovery/discovery.go
index 29caf90..47ed7c3 100644
--- a/go/src/v.io/mojo/discovery/discovery.go
+++ b/go/src/v.io/mojo/discovery/discovery.go
@@ -18,6 +18,7 @@
"v.io/v23"
"v.io/v23/context"
+ "v.io/v23/rpc"
idiscovery "v.io/x/ref/lib/discovery"
fdiscovery "v.io/x/ref/lib/discovery/factory"
@@ -57,6 +58,10 @@
fdiscovery.InjectFactory(df)
// Start a mounttable and set the namespace roots.
+ //
+ // Note that we need to listen on a local IP address in order to
+ // accept connections within a GCE instance.
+ d.ctx = v23.WithListenSpec(d.ctx, rpc.ListenSpec{Addrs: rpc.ListenAddrs{{Protocol: "tcp", Address: "127.0.0.1:0"}}})
name, _, err := mounttablelib.StartServers(d.ctx, v23.GetListenSpec(d.ctx), "", "", "", "", "mounttable")
if err != nil {
panic(err)