mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 06:25:47 +00:00
added TermintionWaitGroup
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
caa795e5f7
commit
ae8d0326e5
@ -9,6 +9,7 @@ import (
|
||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
@ -36,6 +37,7 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
|
||||
// TearDownSuite clean up after testing
|
||||
func (s *E2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e test suite")
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import (
|
||||
"github.com/planetmint/planetmint-go/lib"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
|
||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||
e2etestutil "github.com/planetmint/planetmint-go/testutil/e2e"
|
||||
@ -38,6 +39,7 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
|
||||
// TearDownSuite clean up after testing
|
||||
func (s *E2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e test suite")
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
|
||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/suite"
|
||||
@ -41,6 +42,7 @@ func (s *AssetDistributionE2ETestSuite) SetupSuite() {
|
||||
}
|
||||
|
||||
func (s *AssetDistributionE2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e test suites")
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,7 @@ import (
|
||||
"github.com/planetmint/planetmint-go/testutil/moduleobject"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
@ -93,6 +94,7 @@ func (s *GasConsumptionE2ETestSuite) SetupSuite() {
|
||||
}
|
||||
|
||||
func (s *GasConsumptionE2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e test suites")
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ import (
|
||||
e2etestutil "github.com/planetmint/planetmint-go/testutil/e2e"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -86,6 +87,7 @@ func (s *PopSelectionE2ETestSuite) SetupSuite() {
|
||||
|
||||
// TearDownSuite clean up after testing
|
||||
func (s *PopSelectionE2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e test suite")
|
||||
}
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
e2etestutil "github.com/planetmint/planetmint-go/testutil/e2e"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
daotypes "github.com/planetmint/planetmint-go/x/dao/types"
|
||||
machinetypes "github.com/planetmint/planetmint-go/x/machine/types"
|
||||
"github.com/stretchr/testify/suite"
|
||||
@ -44,6 +45,7 @@ func (s *RestrictedMsgsE2ESuite) SetupSuite() {
|
||||
}
|
||||
|
||||
func (s *RestrictedMsgsE2ESuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e test suite")
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ import (
|
||||
e2etestutil "github.com/planetmint/planetmint-go/testutil/e2e"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
daocli "github.com/planetmint/planetmint-go/x/dao/client/cli"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/suite"
|
||||
@ -109,6 +110,7 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
|
||||
// TearDownSuite clean up after testing
|
||||
func (s *E2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e test suite")
|
||||
}
|
||||
|
||||
|
||||
@ -5,6 +5,7 @@ import (
|
||||
clitestutil "github.com/planetmint/planetmint-go/testutil/cli"
|
||||
"github.com/planetmint/planetmint-go/testutil/network"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
machinecli "github.com/planetmint/planetmint-go/x/machine/client/cli"
|
||||
machinetypes "github.com/planetmint/planetmint-go/x/machine/types"
|
||||
|
||||
@ -49,6 +50,7 @@ func (s *E2ETestSuite) SetupSuite() {
|
||||
|
||||
// TearDownSuite clean up after testing
|
||||
func (s *E2ETestSuite) TearDownSuite() {
|
||||
util.TerminationWaitGroup.Wait()
|
||||
s.T().Log("tearing down e2e test suite")
|
||||
}
|
||||
|
||||
|
||||
@ -14,7 +14,9 @@ import (
|
||||
func buildSignBroadcastTx(goCtx context.Context, loggingContext string, sendingValidatorAddress string, msg sdk.Msg) {
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
GetAppLogger().Info(ctx, loggingContext+": "+msg.String())
|
||||
TerminationWaitGroup.Add(1)
|
||||
go func() {
|
||||
defer TerminationWaitGroup.Done()
|
||||
ctx := sdk.UnwrapSDKContext(goCtx)
|
||||
addr := sdk.MustAccAddressFromBech32(sendingValidatorAddress)
|
||||
txJSON, err := lib.BuildUnsignedTx(addr, msg)
|
||||
|
||||
@ -6,6 +6,7 @@ import (
|
||||
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/planetmint/planetmint-go/testutil/keeper"
|
||||
"github.com/planetmint/planetmint-go/testutil/moduleobject"
|
||||
"github.com/planetmint/planetmint-go/testutil/sample"
|
||||
"github.com/planetmint/planetmint-go/util"
|
||||
"github.com/planetmint/planetmint-go/util/mocks"
|
||||
@ -33,7 +34,7 @@ func TestMachineNFTIssuance(t *testing.T) {
|
||||
util.RegisterAssetServiceHTTPClient = &mocks.MockClient{}
|
||||
_, ctx := keeper.MachineKeeper(t)
|
||||
sk, pk := sample.KeyPair()
|
||||
machine := sample.Machine(pk, pk, sk, "")
|
||||
machine := moduleobject.Machine(pk, pk, sk, "")
|
||||
goCtx := sdk.WrapSDKContext(ctx)
|
||||
|
||||
err := util.IssueMachineNFT(goCtx, &machine, "https", "testnet-asset.rddl.io", "/register_asset")
|
||||
|
||||
5
util/sync.go
Normal file
5
util/sync.go
Normal file
@ -0,0 +1,5 @@
|
||||
package util
|
||||
|
||||
import "sync"
|
||||
|
||||
var TerminationWaitGroup sync.WaitGroup
|
||||
@ -44,7 +44,9 @@ func (k msgServer) AttestMachine(goCtx context.Context, msg *types.MsgAttestMach
|
||||
scheme := params.AssetRegistryScheme
|
||||
domain := params.AssetRegistryDomain
|
||||
path := params.AssetRegistryPath
|
||||
util.TerminationWaitGroup.Add(1)
|
||||
go func() {
|
||||
defer util.TerminationWaitGroup.Done()
|
||||
localErr := util.IssueMachineNFT(goCtx, msg.Machine, scheme, domain, path)
|
||||
if localErr != nil {
|
||||
util.GetAppLogger().Error(ctx, "Machine NFT issuance failed : "+localErr.Error())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user