metrics, tests/load: estimating the remaining number of blocks
This commit is contained in:
parent
9eb0fdfa8a
commit
30502d963d
|
@ -142,7 +142,7 @@ func (mc *metricChain) Stop(strong bool) error {
|
||||||
sub.Unsubscribe()
|
sub.Unsubscribe()
|
||||||
}
|
}
|
||||||
mc.wg.Wait()
|
mc.wg.Wait()
|
||||||
mc.metricsMgr.Export()
|
mc.Export()
|
||||||
return mc.Blockchain.Stop(strong)
|
return mc.Blockchain.Stop(strong)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
// Copyright 2017 AMIS Technologies
|
||||||
|
// This file is part of the go-ethereum library.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public License
|
||||||
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
package metrics
|
||||||
|
|
||||||
|
type Exporter interface {
|
||||||
|
Export()
|
||||||
|
SentTxCount() int64
|
||||||
|
ExcutedTxCount() int64
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mc *metricChain) Export() {
|
||||||
|
mc.metricsMgr.Export()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mc *metricChain) SentTxCount() int64 {
|
||||||
|
return mc.metricsMgr.SentTxCounter.Snapshot().Count()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mc *metricChain) ExcutedTxCount() int64 {
|
||||||
|
return mc.metricsMgr.ExcutedTxCounter.Snapshot().Count()
|
||||||
|
}
|
|
@ -26,6 +26,7 @@ import (
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
. "github.com/onsi/gomega"
|
. "github.com/onsi/gomega"
|
||||||
|
|
||||||
|
istcommon "github.com/getamis/istanbul-tools/common"
|
||||||
"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/metrics"
|
"github.com/getamis/istanbul-tools/metrics"
|
||||||
|
@ -88,8 +89,14 @@ func runTests(numberOfValidators int, gaslimit int, txpoolSize int) {
|
||||||
|
|
||||||
AfterEach(func() {
|
AfterEach(func() {
|
||||||
Expect(blockchain).NotTo(BeNil())
|
Expect(blockchain).NotTo(BeNil())
|
||||||
|
var blocksCnt int = 5
|
||||||
|
metricsExport, ok := blockchain.(metrics.Exporter)
|
||||||
|
if ok {
|
||||||
|
blockSize := gaslimit / int(istcommon.DefaultGasLimit)
|
||||||
|
blocksCnt = int(metricsExport.SentTxCount()-metricsExport.ExcutedTxCount())/blockSize + 1
|
||||||
|
}
|
||||||
tests.WaitFor(blockchain.Validators(), func(geth container.Ethereum, wg *sync.WaitGroup) {
|
tests.WaitFor(blockchain.Validators(), func(geth container.Ethereum, wg *sync.WaitGroup) {
|
||||||
Expect(geth.WaitForBlocks(10)).To(BeNil())
|
Expect(geth.WaitForBlocks(blocksCnt)).To(BeNil())
|
||||||
wg.Done()
|
wg.Done()
|
||||||
})
|
})
|
||||||
Expect(blockchain.Stop(true)).To(BeNil())
|
Expect(blockchain.Stop(true)).To(BeNil())
|
||||||
|
|
Loading…
Reference in New Issue