-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple_echo_attacker.go
42 lines (34 loc) · 1.02 KB
/
simple_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 SimpleEchoContractTestAttack struct {
*loaderbot.Runner
echoRef string
}
func (a *SimpleEchoContractTestAttack) Setup(cfg loaderbot.RunnerConfig) error {
return nil
}
func (a *SimpleEchoContractTestAttack) Do(_ context.Context) loaderbot.DoResult {
sw := a.TestData.(*loaderbot.SharedDataSlice).Get().(util.StickyWallet)
url := sw.Url + util.WalletGetBalancePath
_, err := util.GetWalletBalance(a.HTTPClient, url, statemachine.BuiltinTestAPIBriefEcho)
if err != nil {
return loaderbot.DoResult{
Error: err.Error(),
RequestLabel: a.Name,
}
}
return loaderbot.DoResult{
RequestLabel: a.Name,
}
}
func (a *SimpleEchoContractTestAttack) Clone(r *loaderbot.Runner) loaderbot.Attack {
return &SimpleEchoContractTestAttack{Runner: r}
}
func (a *SimpleEchoContractTestAttack) Teardown() error {
return nil
}