veyron2/rt: allow the profile to actually specify the runtime to use.
Change-Id: I31ec0aad4ed14fc0a97960acde78fe34c26da3d1
diff --git a/runtimes/google/rt/mgmt_test.go b/runtimes/google/rt/mgmt_test.go
index 0737a1e..38c5593 100644
--- a/runtimes/google/rt/mgmt_test.go
+++ b/runtimes/google/rt/mgmt_test.go
@@ -284,7 +284,7 @@
// refer to the global rt.R() function), but we take care to make sure
// that the "google" runtime we are trying to test in this package is
// the one being used.
- r, _ := rt.New(profileOpt, options.GoogleRuntime)
+ r, _ := rt.New(profileOpt)
childcreds := security.NewVeyronCredentials(r.Principal(), appCmd)
configServer, configServiceName, ch := createConfigServer(t, r)
diff --git a/runtimes/google/rt/rt.go b/runtimes/google/rt/rt.go
index 24cacf3..8383b6d 100644
--- a/runtimes/google/rt/rt.go
+++ b/runtimes/google/rt/rt.go
@@ -70,10 +70,6 @@
rt.principal = v.Principal
case options.Profile:
rt.profile = v.Profile
- case options.RuntimeName:
- if v != "google" && v != "" {
- return nil, fmt.Errorf("%q is the wrong name for this runtime", v)
- }
default:
return nil, fmt.Errorf("option has wrong type %T", o)
}
diff --git a/runtimes/google/rt/signal_test.go b/runtimes/google/rt/signal_test.go
index e37f883..e698e77 100644
--- a/runtimes/google/rt/signal_test.go
+++ b/runtimes/google/rt/signal_test.go
@@ -9,6 +9,8 @@
"testing"
"time"
+ "veyron.io/veyron/veyron2"
+ "veyron.io/veyron/veyron2/config"
"veyron.io/veyron/veyron2/options"
"veyron.io/veyron/veyron2/rt"
@@ -21,6 +23,29 @@
modules.RegisterChild("withoutRuntime", "", withoutRuntime)
}
+// A fack profile to explicitly request the Google runtime.
+type myprofile struct{}
+
+func (mp *myprofile) Name() string {
+ return "test"
+}
+
+func (mp *myprofile) Runtime() string {
+ return "google"
+}
+
+func (mp *myprofile) Platform() *veyron2.Platform {
+ return &veyron2.Platform{"google", nil, "v1", "any", "rel1", ".2", "who knows", "this host"}
+}
+
+func (mp *myprofile) String() string {
+ return "myprofile on " + mp.Platform().String()
+}
+
+func (mp *myprofile) Init(veyron2.Runtime, *config.Publisher) error {
+ return nil
+}
+
func simpleEchoProgram(stdin io.Reader, stdout io.Writer) {
fmt.Fprintf(stdout, "ready\n")
scanner := bufio.NewScanner(stdin)
@@ -34,7 +59,7 @@
// Make sure that we use "google" runtime implementation in this
// package even though we have to use the public API which supports
// arbitrary runtime implementations.
- rt.Init(options.GoogleRuntime)
+ rt.Init(options.Profile{&myprofile{}})
simpleEchoProgram(stdin, stdout)
return nil
}