-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathapi_bench_test.go
More file actions
48 lines (38 loc) · 1.07 KB
/
api_bench_test.go
File metadata and controls
48 lines (38 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
Copyright IBM Corp All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package benchmarking
import (
"path"
"testing"
"github.com/hyperledger-labs/fabric-smart-client/integration/benchmark/node"
viewregistry "github.com/hyperledger-labs/fabric-smart-client/platform/view/services/view"
"github.com/stretchr/testify/require"
)
func BenchmarkAPI(b *testing.B) {
testdataPath := b.TempDir()
nodeConfPath := path.Join(testdataPath, "fsc", "nodes", "test-node.0")
err := node.GenerateConfig(testdataPath)
require.NoError(b, err)
n, err := node.SetupNode(nodeConfPath, node.NamedFactory{
Name: "zkp",
Factory: &TokenTxVerifyViewFactory{},
})
require.NoError(b, err)
defer n.Stop()
vm, err := viewregistry.GetManager(n)
require.NoError(b, err)
params := &TokenTxVerifyParams{}
proof, err := GenerateProofData(params)
require.NoError(b, err)
params.Proof, err = proof.ToWire()
require.NoError(b, err)
wl := node.Workload{
Name: "zkp",
Factory: &TokenTxVerifyViewFactory{},
Params: params,
}
b.ResetTimer()
node.RunAPIBenchmark(b, vm, wl)
}