mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
e2e_node: DRA: add CountCalls API
This commit is contained in:
parent
ffc407b4dd
commit
c8c7ae85e5
@ -23,6 +23,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
@ -545,3 +546,14 @@ func (ex *ExamplePlugin) GetGRPCCalls() []GRPCCall {
|
|||||||
calls = append(calls, ex.gRPCCalls...)
|
calls = append(calls, ex.gRPCCalls...)
|
||||||
return calls
|
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