Use the "roaming" instead of "generic" runtime factory.
See vanadium/issues#1289
This required an unfortunate hack to the example fortune server in the
tests here so that the test continues to pass when run on Google Compute
Engine virtual machines.
A more appropriate fix: Setting a tight ListenSpec when running code on
the playground is left as an excercise for the future.
Change-Id: Ie7787d7d0264706d20b7289d06c6523abb6a695c
diff --git a/go/src/v.io/x/playground/builder/builder_v23_test.go b/go/src/v.io/x/playground/builder/builder_v23_test.go
index ff99b03..88bce9b 100644
--- a/go/src/v.io/x/playground/builder/builder_v23_test.go
+++ b/go/src/v.io/x/playground/builder/builder_v23_test.go
@@ -11,7 +11,7 @@
"testing"
"v.io/x/playground/lib/bundle/bundler"
- _ "v.io/x/ref/runtime/factories/generic"
+ _ "v.io/x/ref/runtime/factories/roaming"
tu "v.io/x/ref/test/testutil"
"v.io/x/ref/test/v23test"
)
diff --git a/go/src/v.io/x/playground/bundles/fortune/src/client/client.go b/go/src/v.io/x/playground/bundles/fortune/src/client/client.go
index 4cef015..42a8e0d 100644
--- a/go/src/v.io/x/playground/bundles/fortune/src/client/client.go
+++ b/go/src/v.io/x/playground/bundles/fortune/src/client/client.go
@@ -14,7 +14,7 @@
"v.io/v23"
"v.io/v23/context"
- _ "v.io/x/ref/runtime/factories/generic"
+ _ "v.io/x/ref/runtime/factories/roaming"
"fortune"
)
diff --git a/go/src/v.io/x/playground/bundles/fortune/src/server/server.go b/go/src/v.io/x/playground/bundles/fortune/src/server/server.go
index 7024e30..2ae9896 100644
--- a/go/src/v.io/x/playground/bundles/fortune/src/server/server.go
+++ b/go/src/v.io/x/playground/bundles/fortune/src/server/server.go
@@ -17,7 +17,7 @@
"v.io/x/lib/vlog"
"v.io/x/ref/lib/security/securityflag"
"v.io/x/ref/lib/signals"
- _ "v.io/x/ref/runtime/factories/generic"
+ _ "v.io/x/ref/runtime/factories/roaming"
"fortune"
)
@@ -62,6 +62,20 @@
ctx, shutdown := v23.Init()
defer shutdown()
+ // TODO(ivanpi): The playground executor should somehow force the
+ // ListenSpec to be this way.
+ // When a ListenSpec is not explicitly specified, the "roaming" runtime
+ // factory sets it up to be the public IP address of the virtual
+ // machine running on Google Compute Engine or Amazon Web Services.
+ // Normally, the playground should execute code inside a docker image,
+ // but in tests it is run on the host machine and having this test
+ // service exported on a public IP (when running on GCE) is not an
+ // intent. Furthermore, the test may fail if the firewall rules block
+ // access to the selected port on the public IP.
+ ctx = v23.WithListenSpec(ctx, rpc.ListenSpec{
+ Addrs: rpc.ListenAddrs{{"tcp", "127.0.0.1:0"}},
+ })
+
// Create the fortune server stub.
fortuneServer := fortune.FortuneServer(newFortuned())
diff --git a/go/src/v.io/x/playground/testdata/src/ping/ping.go b/go/src/v.io/x/playground/testdata/src/ping/ping.go
index abdb005..935bd8d 100644
--- a/go/src/v.io/x/playground/testdata/src/ping/ping.go
+++ b/go/src/v.io/x/playground/testdata/src/ping/ping.go
@@ -10,7 +10,7 @@
"fmt"
"v.io/x/lib/vlog"
- _ "v.io/x/ref/runtime/factories/generic"
+ _ "v.io/x/ref/runtime/factories/roaming"
"v.io/x/ref/test"
"pingpong"
diff --git a/go/src/v.io/x/playground/testdata/src/pong/pong.go b/go/src/v.io/x/playground/testdata/src/pong/pong.go
index b00e92c..9dc7ccc 100644
--- a/go/src/v.io/x/playground/testdata/src/pong/pong.go
+++ b/go/src/v.io/x/playground/testdata/src/pong/pong.go
@@ -15,7 +15,7 @@
"v.io/v23/security"
"v.io/x/lib/vlog"
"v.io/x/ref/lib/signals"
- _ "v.io/x/ref/runtime/factories/generic"
+ _ "v.io/x/ref/runtime/factories/roaming"
"v.io/x/ref/test"
"pingpong"