mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
e2e_node: DRA: add CountCalls API
This commit is contained in:
parent
ffc407b4dd
commit
c8c7ae85e5
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user