diff --git a/tests/load/load_test.go b/tests/load/load_test.go index f078f655..bb6f04f9 100644 --- a/tests/load/load_test.go +++ b/tests/load/load_test.go @@ -18,6 +18,7 @@ package load import ( "context" + "fmt" "math/big" "sync" "testing" @@ -27,14 +28,35 @@ import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" + "github.com/getamis/istanbul-tools/charts" "github.com/getamis/istanbul-tools/container" "github.com/getamis/istanbul-tools/k8s" "github.com/getamis/istanbul-tools/tests" ) var _ = Describe("TPS-01: Large amount of transactions", func() { + tests.CaseTable("with number of validators", 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", func(gaslimit int) { 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*3000", 21000*3000), ) + }, tests.Case("4 validators", 4), @@ -73,22 +96,14 @@ func runTests(numberOfValidators int, gaslimit int, txpoolSize int) { k8s.TxPoolSize(txpoolSize), ) 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) { richman, ok := geth.(k8s.RichMan) Expect(ok).To(BeTrue()) var addrs []common.Address - for _, acc := range geth.Accounts() { - addrs = append(addrs, acc.Address) - } + addr := common.HexToAddress("0x1a9afb711302c5f83b5902843d1c007a1a137632") + addrs = append(addrs, addr) // Give ether to all accounts 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() }) }) + + AfterEach(func() { + Expect(blockchain.Stop(true)).To(BeNil()) + blockchain.Finalize() + }) + + It("", func() { + + }) }) }