TestPrecedenceOrderingInConfiguration tests the scenario where the logging part of observability is configured with three client RPC events, the first two on specific methods in the service, the last one for any method within the service. This test sends three RPC's, one corresponding to each log en
(t *testing.T)
| 779 | // which should generate no log entries if an RPC gets to and matches that |
| 780 | // event. |
| 781 | func (s) TestPrecedenceOrderingInConfiguration(t *testing.T) { |
| 782 | fle := &fakeLoggingExporter{ |
| 783 | t: t, |
| 784 | } |
| 785 | |
| 786 | defer func(ne func(ctx context.Context, config *config) (loggingExporter, error)) { |
| 787 | newLoggingExporter = ne |
| 788 | }(newLoggingExporter) |
| 789 | |
| 790 | newLoggingExporter = func(_ context.Context, _ *config) (loggingExporter, error) { |
| 791 | return fle, nil |
| 792 | } |
| 793 | |
| 794 | threeEventsConfig := &config{ |
| 795 | ProjectID: "fake", |
| 796 | CloudLogging: &cloudLogging{ |
| 797 | ClientRPCEvents: []clientRPCEvents{ |
| 798 | { |
| 799 | Methods: []string{"grpc.testing.TestService/UnaryCall"}, |
| 800 | MaxMetadataBytes: 30, |
| 801 | MaxMessageBytes: 30, |
| 802 | }, |
| 803 | { |
| 804 | Methods: []string{"grpc.testing.TestService/EmptyCall"}, |
| 805 | Exclude: true, |
| 806 | MaxMetadataBytes: 30, |
| 807 | MaxMessageBytes: 30, |
| 808 | }, |
| 809 | { |
| 810 | Methods: []string{"grpc.testing.TestService/*"}, |
| 811 | MaxMetadataBytes: 30, |
| 812 | MaxMessageBytes: 30, |
| 813 | }, |
| 814 | }, |
| 815 | }, |
| 816 | } |
| 817 | |
| 818 | cleanup, err := setupObservabilitySystemWithConfig(threeEventsConfig) |
| 819 | if err != nil { |
| 820 | t.Fatalf("error setting up observability %v", err) |
| 821 | } |
| 822 | defer cleanup() |
| 823 | |
| 824 | ss := &stubserver.StubServer{ |
| 825 | EmptyCallF: func(_ context.Context, _ *testpb.Empty) (*testpb.Empty, error) { |
| 826 | return &testpb.Empty{}, nil |
| 827 | }, |
| 828 | UnaryCallF: func(_ context.Context, _ *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { |
| 829 | return &testpb.SimpleResponse{}, nil |
| 830 | }, |
| 831 | FullDuplexCallF: func(stream testgrpc.TestService_FullDuplexCallServer) error { |
| 832 | _, err := stream.Recv() |
| 833 | if err != io.EOF { |
| 834 | return err |
| 835 | } |
| 836 | return nil |
| 837 | }, |
| 838 | } |
nothing calls this directly
no test coverage detected