-
Notifications
You must be signed in to change notification settings - Fork 1
/
fasthttp_echo_attacker.go
42 lines (35 loc) · 1.06 KB
/
fasthttp_echo_attacker.go
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
package ve_perf_tests
import (
"context"
"github.com/insolar/assured-ledger/ledger-core/application/testwalletapi/statemachine"
"github.com/insolar/loaderbot"
"github.com/insolar/ve-perf-tests/util"
)
type EchoContractTestFastHTTPAttack struct {
*loaderbot.Runner
client *loaderbot.FastHTTPClient
echoRef string
}
func (a *EchoContractTestFastHTTPAttack) Setup(cfg loaderbot.RunnerConfig) error {
a.client = loaderbot.NewLoggingFastHTTPClient(cfg.DumpTransport)
return nil
}
func (a *EchoContractTestFastHTTPAttack) Do(_ context.Context) loaderbot.DoResult {
url := a.Cfg.TargetUrl + util.WalletGetBalancePath
err := util.GetWalletBalanceFast(a.client, url, statemachine.BuiltinTestAPIEcho)
if err != nil {
return loaderbot.DoResult{
Error: err.Error(),
RequestLabel: a.Name,
}
}
return loaderbot.DoResult{
RequestLabel: a.Name,
}
}
func (a *EchoContractTestFastHTTPAttack) Clone(r *loaderbot.Runner) loaderbot.Attack {
return &EchoContractTestFastHTTPAttack{Runner: r}
}
func (a *EchoContractTestFastHTTPAttack) Teardown() error {
return nil
}