From c8c7ae85e5310dec6a4bb2d93f4792349726c631 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Fri, 3 May 2024 23:27:48 +0300 Subject: [PATCH] e2e_node: DRA: add CountCalls API --- test/e2e/dra/test-driver/app/kubeletplugin.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/e2e/dra/test-driver/app/kubeletplugin.go b/test/e2e/dra/test-driver/app/kubeletplugin.go index 66df9885fd4..2656a45e10d 100644 --- a/test/e2e/dra/test-driver/app/kubeletplugin.go +++ b/test/e2e/dra/test-driver/app/kubeletplugin.go @@ -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 +}