Add e2e tests for gRPC requests and CLI commands #13

Merged
ashwin merged 14 commits from pm-cli-tests into main 2024-03-04 11:16:11 +00:00
Showing only changes of commit 72fb7e5e46 - Show all commits

View File

@ -2,6 +2,8 @@ package auction
import ( import (
"fmt" "fmt"
"os"
"path/filepath"
"cosmossdk.io/math" "cosmossdk.io/math"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
@ -60,6 +62,8 @@ func (ets *E2ETestSuite) SetupSuite() { //nolint: all
func (ets *E2ETestSuite) TearDownSuite() { func (ets *E2ETestSuite) TearDownSuite() {
ets.T().Log("tearing down integration test suite") ets.T().Log("tearing down integration test suite")
ets.network.Cleanup() ets.network.Cleanup()
ets.cleanupBidFiles()
} }
func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAddress *string) { func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAddress *string) {
@ -125,3 +129,20 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri
return auctionId return auctionId
} }
func (ets *E2ETestSuite) cleanupBidFiles() error {
matches, err := filepath.Glob(fmt.Sprintf("%s-*.json", bidderAccount))
if err != nil {
fmt.Printf("Error matching bidder files: %v\n", err)
return err
}
for _, match := range matches {
err := os.Remove(match)
if err != nil {
return err
}
}
return nil
}