test/load: add validator service chart installation/uninstallation
This commit is contained in:
parent
fa49030524
commit
a9bf3cfb40
|
@ -18,6 +18,7 @@ package load
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -27,14 +28,35 @@ import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
|
"github.com/getamis/istanbul-tools/charts"
|
||||||
"github.com/getamis/istanbul-tools/container"
|
"github.com/getamis/istanbul-tools/container"
|
||||||
"github.com/getamis/istanbul-tools/k8s"
|
"github.com/getamis/istanbul-tools/k8s"
|
||||||
"github.com/getamis/istanbul-tools/tests"
|
"github.com/getamis/istanbul-tools/tests"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = Describe("TPS-01: Large amount of transactions", func() {
|
var _ = Describe("TPS-01: Large amount of transactions", func() {
|
||||||
|
|
||||||
tests.CaseTable("with number of validators",
|
tests.CaseTable("with number of validators",
|
||||||
func(numberOfValidators int) {
|
func(numberOfValidators int) {
|
||||||
|
var svcCharts []*charts.ValidatorServiceChart
|
||||||
|
|
||||||
|
BeforeSuite(func() {
|
||||||
|
for i := 0; i < numberOfValidators; i++ {
|
||||||
|
chart := charts.NewValidatorServiceChart(fmt.Sprintf("%d", i), nil)
|
||||||
|
svcCharts = append(svcCharts, chart)
|
||||||
|
|
||||||
|
if err := chart.Install(false); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
AfterSuite(func() {
|
||||||
|
for i := 0; i < numberOfValidators; i++ {
|
||||||
|
svcCharts[i].Uninstall()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
tests.CaseTable("with gas limit",
|
tests.CaseTable("with gas limit",
|
||||||
func(gaslimit int) {
|
func(gaslimit int) {
|
||||||
tests.CaseTable("with txpool size",
|
tests.CaseTable("with txpool size",
|
||||||
|
@ -50,6 +72,7 @@ var _ = Describe("TPS-01: Large amount of transactions", func() {
|
||||||
tests.Case("21000*1000", 21000*1000),
|
tests.Case("21000*1000", 21000*1000),
|
||||||
tests.Case("21000*3000", 21000*3000),
|
tests.Case("21000*3000", 21000*3000),
|
||||||
)
|
)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
tests.Case("4 validators", 4),
|
tests.Case("4 validators", 4),
|
||||||
|
@ -73,22 +96,14 @@ func runTests(numberOfValidators int, gaslimit int, txpoolSize int) {
|
||||||
k8s.TxPoolSize(txpoolSize),
|
k8s.TxPoolSize(txpoolSize),
|
||||||
)
|
)
|
||||||
Expect(blockchain.Start(true)).To(BeNil())
|
Expect(blockchain.Start(true)).To(BeNil())
|
||||||
})
|
|
||||||
|
|
||||||
AfterEach(func() {
|
|
||||||
Expect(blockchain.Stop(true)).To(BeNil())
|
|
||||||
blockchain.Finalize()
|
|
||||||
})
|
|
||||||
|
|
||||||
It("", func() {
|
|
||||||
tests.WaitFor(blockchain.Validators(), func(geth container.Ethereum, wg *sync.WaitGroup) {
|
tests.WaitFor(blockchain.Validators(), func(geth container.Ethereum, wg *sync.WaitGroup) {
|
||||||
richman, ok := geth.(k8s.RichMan)
|
richman, ok := geth.(k8s.RichMan)
|
||||||
Expect(ok).To(BeTrue())
|
Expect(ok).To(BeTrue())
|
||||||
|
|
||||||
var addrs []common.Address
|
var addrs []common.Address
|
||||||
for _, acc := range geth.Accounts() {
|
addr := common.HexToAddress("0x1a9afb711302c5f83b5902843d1c007a1a137632")
|
||||||
addrs = append(addrs, acc.Address)
|
addrs = append(addrs, addr)
|
||||||
}
|
|
||||||
|
|
||||||
// Give ether to all accounts
|
// Give ether to all accounts
|
||||||
err := richman.GiveEther(context.Background(), addrs, new(big.Int).Exp(big.NewInt(10), big.NewInt(24), nil))
|
err := richman.GiveEther(context.Background(), addrs, new(big.Int).Exp(big.NewInt(10), big.NewInt(24), nil))
|
||||||
|
@ -100,6 +115,15 @@ func runTests(numberOfValidators int, gaslimit int, txpoolSize int) {
|
||||||
wg.Done()
|
wg.Done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
AfterEach(func() {
|
||||||
|
Expect(blockchain.Stop(true)).To(BeNil())
|
||||||
|
blockchain.Finalize()
|
||||||
|
})
|
||||||
|
|
||||||
|
It("", func() {
|
||||||
|
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue