Skip to content

Commit

Permalink
Add provider events in publish test
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilkumarpilli authored and boz committed Jun 18, 2020
1 parent 211926f commit 3aacaf3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions events/publish.go
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/ovrclk/akash/sdkutil"
dtypes "github.com/ovrclk/akash/x/deployment/types"
mtypes "github.com/ovrclk/akash/x/market/types"
ptypes "github.com/ovrclk/akash/x/provider/types"
abci "github.com/tendermint/tendermint/abci/types"
tmclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
Expand Down Expand Up @@ -99,5 +100,9 @@ func processEvent(bev abci.Event) (interface{}, bool) {
return mev, true
}

if mev, err := ptypes.ParseEvent(ev); err == nil {
return mev, true
}

return nil, false
}
6 changes: 6 additions & 0 deletions events/publish_test.go
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/ovrclk/akash/testutil"
dtypes "github.com/ovrclk/akash/x/deployment/types"
mtypes "github.com/ovrclk/akash/x/market/types"
ptypes "github.com/ovrclk/akash/x/provider/types"
"github.com/stretchr/testify/assert"
)

Expand All @@ -25,6 +26,11 @@ func Test_processEvent(t *testing.T) {
mtypes.EventBidClosed{ID: testutil.BidID(t), Price: testutil.Coin(t)},
mtypes.EventLeaseCreated{ID: testutil.LeaseID(t), Price: testutil.Coin(t)},
mtypes.EventLeaseClosed{ID: testutil.LeaseID(t), Price: testutil.Coin(t)},

// x/provider events
ptypes.EventProviderCreate{Owner: testutil.AccAddress(t)},
ptypes.EventProviderUpdate{Owner: testutil.AccAddress(t)},
ptypes.EventProviderDelete{Owner: testutil.AccAddress(t)},
}

for _, test := range tests {
Expand Down
3 changes: 0 additions & 3 deletions x/market/types/event.go
Expand Up @@ -18,9 +18,6 @@ const (
evActionLeaseCreated = "lease-created"
evActionLeaseClosed = "lease-closed"

evOwnerKey = "owner"
evDSeqKey = "dseq"
evGSeqKey = "gseq"
evOSeqKey = "oseq"
evProviderKey = "provider"
evPriceDenomKey = "price-denom"
Expand Down
3 changes: 3 additions & 0 deletions x/market/types/events_test.go
Expand Up @@ -17,6 +17,9 @@ var (
//keyParams = sdk.NewKVStoreKey(params.StoreKey)

errWildcard = errors.New("wildcard string error can't be matched")
evOwnerKey = "owner"
evDSeqKey = "dseq"
evGSeqKey = "gseq"
)

type testEventParsing struct {
Expand Down

0 comments on commit 3aacaf3

Please sign in to comment.