From 72fb7e5e4674f4130a19055986688d794cf4bdc0 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Sat, 2 Mar 2024 10:59:01 +0530 Subject: [PATCH] Remove bid files in test cleanup --- tests/e2e/auction/suite.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/e2e/auction/suite.go b/tests/e2e/auction/suite.go index 5cd1f3dc..d408b253 100644 --- a/tests/e2e/auction/suite.go +++ b/tests/e2e/auction/suite.go @@ -2,6 +2,8 @@ package auction import ( "fmt" + "os" + "path/filepath" "cosmossdk.io/math" "github.com/stretchr/testify/suite" @@ -60,6 +62,8 @@ func (ets *E2ETestSuite) SetupSuite() { //nolint: all func (ets *E2ETestSuite) TearDownSuite() { ets.T().Log("tearing down integration test suite") ets.network.Cleanup() + + ets.cleanupBidFiles() } func (ets *E2ETestSuite) createAccountWithBalance(accountName string, accountAddress *string) { @@ -125,3 +129,20 @@ func (ets *E2ETestSuite) createAuctionAndBid(createAuction, createBid bool) stri 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 +}