e2e_node: DRA: add CountCalls API

This commit is contained in:
Ed Bartosh 2024-05-03 23:27:48 +03:00
parent ffc407b4dd
commit c8c7ae85e5

View File

@ -23,6 +23,7 @@ import (
"fmt"
"os"
"path/filepath"
"strings"
"sync"
"github.com/google/go-cmp/cmp"
@ -545,3 +546,14 @@ func (ex *ExamplePlugin) GetGRPCCalls() []GRPCCall {
calls = append(calls, ex.gRPCCalls...)
return calls
}
// CountCalls counts GRPC calls with the given method suffix.
func (ex *ExamplePlugin) CountCalls(methodSuffix string) int {
count := 0
for _, call := range ex.GetGRPCCalls() {
if strings.HasSuffix(call.FullMethod, methodSuffix) {
count += 1
}
}
return count
}