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) {
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 {
@ -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)
}