chengxilo commented on code in PR #3063:
URL: https://github.com/apache/iggy/pull/3063#discussion_r3034356863


##########
bdd/go/tests/basic_messaging.go:
##########
@@ -322,10 +363,20 @@ func initBasicMessagingScenario(sc 
*godog.ScenarioContext) {
        sc.Step(`the topic should be created successfully`, 
s.thenTopicCreatedSuccessfully)
        sc.Step(`^the topic should have name "([^"]*)"$`, s.thenTopicHasName)
        sc.Step(`^the topic should have (\d+) partitions$`, 
s.thenTopicsHasPartitions)
+       sc.Step(`^I update the stream name to "([^"]*)"$`, 
s.whenUpdateStreamName)
+       sc.Step(`^the stream name should be updated to "([^"]*)"$`, 
s.thenStreamNameUpdated)
+       sc.Step(`I delete the stream`, s.whenDeleteStream)
+       sc.Step(`the stream should be deleted successfully`, 
s.thenStreamDeletedSuccessfully)
        sc.After(func(ctx context.Context, sc *godog.Scenario, scErr error) 
(context.Context, error) {
                c := getBasicMessagingCtx(ctx)
-               if err := c.client.Close(); err != nil {
-                       scErr = errors.Join(scErr, fmt.Errorf("error closing 
client: %w", err))
+               if c.client != nil && c.lastStreamID != nil {
+                       streamIdentifier, _ := 
iggcon.NewIdentifier(*c.lastStreamID)
+                       _ = c.client.DeleteStream(streamIdentifier)
+               }
+               if c.client != nil {
+                       if err := c.client.Close(); err != nil {
+                               scErr = errors.Join(scErr, fmt.Errorf("error 
closing client: %w", err))
+                       }

Review Comment:
   I’m not sure it’s worth cleaning this up. Even if we do want to, this 
approach isn’t ideal. We should probably provide a script that cleans up all 
resources instead (e.g., fetch all streams, topics, users, etc., and delete 
them), which would work across all scenarios and ensure everything is properly 
cleaned.
   
   For example, if CreateStream(A) actually creates a stream B, but 
DeleteStream(A) only attempts to delete A, then who is responsible for deleting 
B?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to