update test assertion for latest version of grpc-go (#366)

This commit is contained in:
Joshua Humphries 2023-01-30 19:56:36 -05:00 committed by GitHub
parent 3790bae00f
commit b076fa228d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 14 deletions

View File

@ -243,12 +243,8 @@ func doTestListMethods(t *testing.T, source DescriptorSource, includeReflection
func TestGetAllFiles(t *testing.T) { func TestGetAllFiles(t *testing.T) {
expectedFiles := []string{"test.proto"} expectedFiles := []string{"test.proto"}
// server reflection picks up filename from linked in Go package, expectedFilesWithReflection := []string{
// which indicates "grpc_testing/test.proto", not our local copy. "grpc/reflection/v1alpha/reflection.proto", "test.proto",
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"},
} }
for _, ds := range descSources { for _, ds := range descSources {
@ -261,17 +257,11 @@ func TestGetAllFiles(t *testing.T) {
match := false match := false
var expected []string var expected []string
if ds.includeRefl { if ds.includeRefl {
for _, expectedNames := range expectedFilesWithReflection { expected = expectedFilesWithReflection
expected = expectedNames
if reflect.DeepEqual(expected, names) {
match = true
break
}
}
} else { } else {
expected = expectedFiles expected = expectedFiles
match = reflect.DeepEqual(expected, names)
} }
match = reflect.DeepEqual(expected, names)
if !match { if !match {
t.Errorf("GetAllFiles returned wrong results: wanted %v, got %v", expected, names) t.Errorf("GetAllFiles returned wrong results: wanted %v, got %v", expected, names)
} }