Merge "veyron/runtimes/google/ipc: Failed name resolution should be retryable."
diff --git a/lib/testutil/glob.go b/lib/testutil/glob.go
index 0bc1482..fa36e79 100644
--- a/lib/testutil/glob.go
+++ b/lib/testutil/glob.go
@@ -4,15 +4,17 @@
"io"
"sort"
+ "veyron.io/veyron/veyron2"
+ "veyron.io/veyron/veyron2/context"
"veyron.io/veyron/veyron2/ipc"
"veyron.io/veyron/veyron2/naming"
- "veyron.io/veyron/veyron2/rt"
)
// GlobName calls __Glob on the given object with the given pattern and returns
// a sorted list of matching object names, or an error.
-func GlobName(name, pattern string) ([]string, error) {
- call, err := rt.R().Client().StartCall(rt.R().NewContext(), name, ipc.GlobMethod, []interface{}{pattern})
+func GlobName(ctx context.T, name, pattern string) ([]string, error) {
+ client := ctx.Runtime().(veyron2.Runtime).Client()
+ call, err := client.StartCall(ctx, name, ipc.GlobMethod, []interface{}{pattern})
if err != nil {
return nil, err
}
diff --git a/runtimes/google/ipc/glob_test.go b/runtimes/google/ipc/glob_test.go
index 21d8631..79e9859 100644
--- a/runtimes/google/ipc/glob_test.go
+++ b/runtimes/google/ipc/glob_test.go
@@ -34,7 +34,10 @@
}
func TestGlob(t *testing.T) {
- runtime := rt.Init()
+ runtime, err := rt.New()
+ if err != nil {
+ panic(err)
+ }
defer runtime.Cleanup()
namespace := []string{
@@ -158,7 +161,7 @@
}
for _, tc := range testcases {
name := naming.JoinAddressName(ep, tc.name)
- results, err := testutil.GlobName(name, tc.pattern)
+ results, err := testutil.GlobName(runtime.NewContext(), name, tc.pattern)
if err != nil {
t.Errorf("unexpected Glob error for (%q, %q): %v", tc.name, tc.pattern, err)
continue
diff --git a/services/mgmt/application/impl/impl_test.go b/services/mgmt/application/impl/impl_test.go
index 9b4395c..d8c158c 100644
--- a/services/mgmt/application/impl/impl_test.go
+++ b/services/mgmt/application/impl/impl_test.go
@@ -100,7 +100,7 @@
}
// Test Glob
- matches, err := testutil.GlobName(naming.JoinAddressName(endpoint.String(), ""), "...")
+ matches, err := testutil.GlobName(ctx, naming.JoinAddressName(endpoint.String(), ""), "...")
if err != nil {
t.Errorf("Unexpected Glob error: %v", err)
}
diff --git a/services/mgmt/binary/impl/impl_test.go b/services/mgmt/binary/impl/impl_test.go
index 4eaa06e..35aa2e3 100644
--- a/services/mgmt/binary/impl/impl_test.go
+++ b/services/mgmt/binary/impl/impl_test.go
@@ -188,7 +188,7 @@
if bytes.Compare(output, data) != 0 {
t.Fatalf("Unexpected output: expected %v, got %v", data, output)
}
- results, err := testutil.GlobName(naming.JoinAddressName(ep, ""), "...")
+ results, err := testutil.GlobName(rt.R().NewContext(), naming.JoinAddressName(ep, ""), "...")
if err != nil {
t.Fatalf("GlobName failed: %v", err)
}
@@ -379,7 +379,7 @@
t.FailNow()
}
}
- results, err := testutil.GlobName(naming.JoinAddressName(ep, ""), "...")
+ results, err := testutil.GlobName(rt.R().NewContext(), naming.JoinAddressName(ep, ""), "...")
if err != nil {
t.Fatalf("GlobName failed: %v", err)
}
diff --git a/services/mgmt/debug/dispatcher_test.go b/services/mgmt/debug/dispatcher_test.go
index f49afd2..46fd799 100644
--- a/services/mgmt/debug/dispatcher_test.go
+++ b/services/mgmt/debug/dispatcher_test.go
@@ -75,7 +75,7 @@
// Access a logs directory that exists.
{
- results, err := testutil.GlobName(naming.JoinAddressName(endpoint, "debug/logs"), "*")
+ results, err := testutil.GlobName(runtime.NewContext(), naming.JoinAddressName(endpoint, "debug/logs"), "*")
if err != nil {
t.Errorf("Glob failed: %v", err)
}
@@ -86,7 +86,7 @@
// Access a logs directory that doesn't exist.
{
- results, err := testutil.GlobName(naming.JoinAddressName(endpoint, "debug/logs/nowheretobefound"), "*")
+ results, err := testutil.GlobName(runtime.NewContext(), naming.JoinAddressName(endpoint, "debug/logs/nowheretobefound"), "*")
if len(results) != 0 {
t.Errorf("unexpected result. Got %v, want ''", results)
}
diff --git a/services/mgmt/node/impl/impl_test.go b/services/mgmt/node/impl/impl_test.go
index ad669d5..103b2d4 100644
--- a/services/mgmt/node/impl/impl_test.go
+++ b/services/mgmt/node/impl/impl_test.go
@@ -1013,7 +1013,7 @@
logFileRemoveErrorFatalWarningRE := regexp.MustCompile("(ERROR|FATAL|WARNING)")
statsTrimRE := regexp.MustCompile("/stats/(ipc|system(/start-time.*)?)$")
for _, tc := range testcases {
- results, err := testutil.GlobName(tc.name, tc.pattern)
+ results, err := testutil.GlobName(rt.R().NewContext(), tc.name, tc.pattern)
if err != nil {
t.Errorf("unexpected glob error for (%q, %q): %v", tc.name, tc.pattern, err)
continue
@@ -1041,7 +1041,7 @@
}
// Call Size() on the log file objects.
- files, err := testutil.GlobName("nm", "apps/google naps/"+installID+"/"+instance1ID+"/logs/*")
+ files, err := testutil.GlobName(rt.R().NewContext(), "nm", "apps/google naps/"+installID+"/"+instance1ID+"/logs/*")
if err != nil {
t.Errorf("unexpected glob error: %v", err)
}
@@ -1057,7 +1057,7 @@
}
// Call Value() on some of the stats objects.
- objects, err := testutil.GlobName("nm", "apps/google naps/"+installID+"/"+instance1ID+"/stats/system/start-time*")
+ objects, err := testutil.GlobName(rt.R().NewContext(), "nm", "apps/google naps/"+installID+"/"+instance1ID+"/stats/system/start-time*")
if err != nil {
t.Errorf("unexpected glob error: %v", err)
}