From 1cc3d4bc94afdec58779936d44f9cef127973efa Mon Sep 17 00:00:00 2001 From: Omar Abdulaziz Date: Sun, 29 Oct 2023 18:48:19 +0200 Subject: [PATCH] add perf calls --- grid-client/node/node.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/grid-client/node/node.go b/grid-client/node/node.go index 271b6c060..378723aa5 100644 --- a/grid-client/node/node.go +++ b/grid-client/node/node.go @@ -374,6 +374,34 @@ func (n *NodeClient) SystemVersion(ctx context.Context) (ver Version, err error) return } +// GetPerfTestsResults get all perf tests results +func (n *NodeClient) GetPerfTestsResults(ctx context.Context) (result string, err error) { + ctx, cancel := context.WithTimeout(ctx, n.timeout) + defer cancel() + + const cmd = "zos.perf.get_all" + + if err = n.bus.Call(ctx, n.nodeTwin, cmd, nil, &result); err != nil { + return + } + + return +} + +// GetPerfTestResult get a single perf test result +func (n *NodeClient) GetPerfTestResult(ctx context.Context, testName string) (result string, err error) { + ctx, cancel := context.WithTimeout(ctx, n.timeout) + defer cancel() + + const cmd = "zos.perf.get" + + if err = n.bus.Call(ctx, n.nodeTwin, cmd, testName, &result); err != nil { + return + } + + return +} + // IsNodeUp checks if the node is up func (n *NodeClient) IsNodeUp(ctx context.Context) error { _, err := n.SystemVersion(ctx)