[grpclb and fake resolver] clean up e2e tests and simplify fake resolver (#34887)

Changes to fake resolver:
- Add `WaitForReresolutionRequest()` method to fake resolver response
generator to allow tests to tell when re-resolution has been requested.
- Change fake resolver response generator API to have only one mechanism
for injecting results, regardless of whether the result is an error or
whether it's triggered by a re-resolution.

Changes to grpclb_end2end_test:
- Change balancer interface such that instead of setting a list of
responses with fixed delays, the test can control exactly when each
response is set.
- Change balancer impl to always send the initial LB response, as
expected by the grpclb protocol.
- Change balancer impl to always read load reports, even if load
reporting is not expected to be enabled. (The latter case will still
cause the test to fail.) Reads are done in a different thread than
writes.
- Allow each test to directly control how many backends and balancers
are started and the client load reporting interval, so that (a) we don't
waste resources starting servers we don't need and (b) there is no need
to arbitrarily split tests across different test classes.
- Add timeouts to `WaitForAllBackends()` functionality, so that tests
will fail with a useful error rather than timing out.
- Improved ergonomics of various helper functions in the test framework.

In the process of making these changes, I found a couple of bugs:
- A bug in pick_first, which I fixed in #34885.
- A bug in grpclb, in which we were using the wrong condition to decide
whether to propagate a re-resolution request from the child policy,
which I've fixed in this PR. (This bug probably originated way back in
#18344.)

This should address a lot of the flakes seen in grpclb_e2e_test
recently.
11 files changed
tree: 2458da3a5c216346fd8c6cd31ed062e949711975
  1. .bazelci/
  2. .github/
  3. bazel/
  4. cmake/
  5. doc/
  6. etc/
  7. examples/
  8. fuzztest/
  9. include/
  10. spm-core-include/
  11. spm-cpp-include/
  12. src/
  13. summerofcode/
  14. templates/
  15. test/
  16. third_party/
  17. tools/
  18. .bazelignore
  19. .bazelrc
  20. .bazelversion
  21. .clang-format
  22. .clang-tidy
  23. .dockerignore
  24. .editorconfig
  25. .git-blame-ignore-revs
  26. .gitallowed
  27. .gitattributes
  28. .gitignore
  29. .gitmodules
  30. .istanbul.yml
  31. .pylintrc
  32. .pylintrc-examples
  33. .pylintrc-tests
  34. .rspec
  35. .yapfignore
  36. .yardopts
  37. _metadata.py
  38. AUTHORS
  39. black.toml
  40. BUILD
  41. build_autogenerated.yaml
  42. build_config.rb
  43. build_handwritten.yaml
  44. BUILDING.md
  45. CMakeLists.txt
  46. CODE-OF-CONDUCT.md
  47. composer.json
  48. CONCEPTS.md
  49. config.m4
  50. config.w32
  51. CONTRIBUTING.md
  52. Gemfile
  53. GOVERNANCE.md
  54. gRPC-C++.podspec
  55. gRPC-Core.podspec
  56. gRPC-ProtoRPC.podspec
  57. gRPC-RxLibrary.podspec
  58. grpc.bzl
  59. grpc.def
  60. grpc.gemspec
  61. grpc.gyp
  62. gRPC.podspec
  63. LICENSE
  64. MAINTAINERS.md
  65. Makefile
  66. MANIFEST.md
  67. NOTICE.txt
  68. OWNERS
  69. Package.swift
  70. package.xml
  71. PYTHON-MANIFEST.in
  72. Rakefile
  73. README.md
  74. requirements.bazel.txt
  75. requirements.txt
  76. SECURITY.md
  77. setup.cfg
  78. setup.py
  79. TROUBLESHOOTING.md
  80. WORKSPACE
README.md

gRPC – An RPC library and framework

gRPC is a modern, open source, high-performance remote procedure call (RPC) framework that can run anywhere. gRPC enables client and server applications to communicate transparently, and simplifies the building of connected systems.

Join the chat at https://gitter.im/grpc/grpc

To start using gRPC

To maximize usability, gRPC supports the standard method for adding dependencies to a user‘s chosen language (if there is one). In most languages, the gRPC runtime comes as a package available in a user’s language package manager.

For instructions on how to use the language-specific gRPC runtime for a project, please refer to these documents

  • C++: follow the instructions under the src/cpp directory
  • C#/.NET: NuGet packages Grpc.Net.Client, Grpc.AspNetCore.Server
  • Dart: pub package grpc
  • Go: go get google.golang.org/grpc
  • Java: Use JARs from Maven Central Repository
  • Kotlin: Use JARs from Maven Central Repository
  • Node: npm install @grpc/grpc-js
  • Objective-C: Add gRPC-ProtoRPC dependency to podspec
  • PHP: pecl install grpc
  • Python: pip install grpcio
  • Ruby: gem install grpc
  • WebJS: follow the grpc-web instructions

Per-language quickstart guides and tutorials can be found in the documentation section on the grpc.io website. Code examples are available in the examples directory.

Precompiled bleeding-edge package builds of gRPC master branch's HEAD are uploaded daily to packages.grpc.io.

To start developing gRPC

Contributions are welcome!

Please read How to contribute which will guide you through the entire workflow of how to build the source code, how to run the tests, and how to contribute changes to the gRPC codebase. The “How to contribute” document also contains info on how the contribution process works and contains best practices for creating contributions.

Troubleshooting

Sometimes things go wrong. Please check out the Troubleshooting guide if you are experiencing issues with gRPC.

Performance

See the Performance dashboard for performance numbers of master branch daily builds.

Concepts

See gRPC Concepts

About This Repository

This repository contains source code for gRPC libraries implemented in multiple languages written on top of a shared C core library src/core.

Libraries in different languages may be in various states of development. We are seeking contributions for all of these libraries:

LanguageSource
Shared C [core library]src/core
C++src/cpp
Rubysrc/ruby
Pythonsrc/python
PHPsrc/php
C# (core library based)src/csharp
Objective-Csrc/objective-c
LanguageSource repo
Javagrpc-java
Kotlingrpc-kotlin
Gogrpc-go
NodeJSgrpc-node
WebJSgrpc-web
Dartgrpc-dart
.NET (pure C# impl.)grpc-dotnet
Swiftgrpc-swift