Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix test expectations for latest version of grpc-go #366

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions grpcurl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,8 @@ func doTestListMethods(t *testing.T, source DescriptorSource, includeReflection

func TestGetAllFiles(t *testing.T) {
expectedFiles := []string{"test.proto"}
// server reflection picks up filename from linked in Go package,
// which indicates "grpc_testing/test.proto", not our local copy.
expectedFilesWithReflection := [][]string{
{"grpc_reflection_v1alpha/reflection.proto", "test.proto"},
// depending on the version of grpc, the filenames could be prefixed with "interop/" and "reflection/"
{"reflection/grpc_reflection_v1alpha/reflection.proto", "test.proto"},
expectedFilesWithReflection := []string{
"grpc/reflection/v1alpha/reflection.proto", "test.proto",
}

for _, ds := range descSources {
Expand All @@ -261,17 +257,11 @@ func TestGetAllFiles(t *testing.T) {
match := false
var expected []string
if ds.includeRefl {
for _, expectedNames := range expectedFilesWithReflection {
expected = expectedNames
if reflect.DeepEqual(expected, names) {
match = true
break
}
}
expected = expectedFilesWithReflection
} else {
expected = expectedFiles
match = reflect.DeepEqual(expected, names)
}
match = reflect.DeepEqual(expected, names)
if !match {
t.Errorf("GetAllFiles returned wrong results: wanted %v, got %v", expected, names)
}
Expand Down