Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions nodebuilder/tests/tastora/blob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ func (s *BlobTestSuite) SetupSuite() {
s.Require().NoError(s.framework.SetupNetwork(ctx))
}

func (s *BlobTestSuite) TearDownSuite() {
if s.framework != nil {
s.framework.Cleanup()
}
}

// TestBlobSubmit_SingleBlob tests blob submission API with a single blob
func (s *BlobTestSuite) TestBlobSubmit_SingleBlob() {
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
Expand Down
6 changes: 6 additions & 0 deletions nodebuilder/tests/tastora/e2e_sanity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ func (s *E2ESanityTestSuite) SetupSuite() {
s.framework.NewLightNode(ctx)
}

func (s *E2ESanityTestSuite) TearDownSuite() {
if s.framework != nil {
s.framework.Cleanup()
}
}

// TestBasicDASFlow validates basic Data Availability Sampling functionality on a single bridge node
func (s *E2ESanityTestSuite) TestBasicDASFlow() {
ctx, cancel := s.withTimeout()
Expand Down
56 changes: 56 additions & 0 deletions nodebuilder/tests/tastora/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -534,3 +534,59 @@ func (f *Framework) getOrCreateFundingWallet(ctx context.Context) *types.Wallet
}
return f.fundingWallet
}

// Cleanup performs cleanup of all Docker resources created by the framework.
// This includes stopping containers and removing the Docker network.
func (f *Framework) Cleanup() {
if f.client == nil {
return
}

ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

f.logger.Info("Starting framework cleanup", zap.String("network", f.network))

// Stop all bridge nodes
for i, bridgeNode := range f.bridgeNodes {
if bridgeNode != nil {
f.logger.Info("Stopping bridge node", zap.Int("index", i))
if err := bridgeNode.Stop(ctx); err != nil {
f.t.Logf("Failed to stop bridge node %d: %v", i, err)
}
}
}

// Stop all light nodes
for i, lightNode := range f.lightNodes {
if lightNode != nil {
f.logger.Info("Stopping light node", zap.Int("index", i))
if err := lightNode.Stop(ctx); err != nil {
f.t.Logf("Failed to stop light node %d: %v", i, err)
}
}
}

// Stop the Celestia chain
if f.celestia != nil {
f.logger.Info("Stopping Celestia chain")
if err := f.celestia.Stop(ctx); err != nil {
f.t.Logf("Failed to stop Celestia chain: %v", err)
}
}

// Note: DA network cleanup is handled by stopping individual nodes above
// The tastora framework doesn't provide a direct Stop method for the network

// Remove the Docker network
if f.network != "" {
f.logger.Info("Removing Docker network", zap.String("network", f.network))
if err := f.client.NetworkRemove(ctx, f.network); err != nil {
f.t.Logf("Failed to remove Docker network %s: %v", f.network, err)
} else {
f.logger.Info("Successfully removed Docker network", zap.String("network", f.network))
}
}

f.logger.Info("Framework cleanup completed")
}