tests/load: update load testing skeleton, use k8s blockchain implementation

This commit is contained in:
Alan Chen 2017-09-13 11:06:36 +08:00
parent f33dfd9749
commit f58845f6ac
1 changed files with 19 additions and 17 deletions

View File

@ -19,12 +19,12 @@ package load
import ( import (
"testing" "testing"
"github.com/getamis/istanbul-tools/charts"
"github.com/getamis/istanbul-tools/common"
"github.com/getamis/istanbul-tools/tests"
. "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo"
. "github.com/onsi/gomega" . "github.com/onsi/gomega"
"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() { var _ = Describe("TPS-01: Large amount of transactions", func() {
@ -48,38 +48,40 @@ var _ = Describe("TPS-01: Large amount of transactions", func() {
}, },
tests.Case("4 validators", 4), tests.Case("4 validators", 4),
tests.Case("7 validators", 7),
tests.Case("10 validators", 10),
) )
}) })
func runTests(numberOfValidators int, gaslimit int, txpoolSize int) { func runTests(numberOfValidators int, gaslimit int, txpoolSize int) {
Describe("", func() { Describe("", func() {
var ( var (
genesisChart tests.ChartInstaller blockchain container.Blockchain
staticNodesChart tests.ChartInstaller
) )
BeforeEach(func() { BeforeEach(func() {
_, nodekeys, addrs := common.GenerateKeys(numberOfValidators) blockchain = k8s.NewBlockchain(
genesisChart = charts.NewGenesisChart(addrs, uint64(gaslimit)) numberOfValidators,
Expect(genesisChart.Install(false)).To(BeNil()) uint64(gaslimit),
k8s.ImageRepository("quay.io/amis/geth"),
staticNodesChart = charts.NewStaticNodesChart(nodekeys, common.GenerateIPs(len(nodekeys))) k8s.ImageTag("istanbul_develop"),
Expect(staticNodesChart.Install(false)).To(BeNil()) k8s.ServiceType("LoadBalancer"),
k8s.Mine(),
k8s.TxPoolSize(txpoolSize),
)
Expect(blockchain.Start(true)).To(BeNil())
}) })
AfterEach(func() { AfterEach(func() {
Expect(genesisChart.Uninstall()).To(BeNil()) Expect(blockchain.Stop(true)).To(BeNil())
Expect(staticNodesChart.Uninstall()).To(BeNil()) blockchain.Finalize()
}) })
It("", func() { It("", func() {
}) })
}) })
} }
func IstanbulLoadTest(t *testing.T) { func TestIstanbulLoadTesting(t *testing.T) {
RegisterFailHandler(Fail) RegisterFailHandler(Fail)
RunSpecs(t, "Istanbul Load Test Suite") RunSpecs(t, "Istanbul Load Test Suite")
} }