chengxilo commented on code in PR #3063:
URL: https://github.com/apache/iggy/pull/3063#discussion_r3034337960
##########
bdd/go/tests/basic_messaging.go:
##########
@@ -209,6 +209,47 @@ func (s basicMessagingSteps)
thenLastPolledMessageMatchesSent(ctx context.Contex
return nil
}
+func (s basicMessagingSteps) whenUpdateStreamName(ctx context.Context, newName
string) error {
+ c := getBasicMessagingCtx(ctx)
+ streamIdentifier, _ := iggcon.NewIdentifier(*c.lastStreamID)
+ if err := c.client.UpdateStream(streamIdentifier, newName); err != nil {
+ return fmt.Errorf("failed to update stream: %w", err)
+ }
+ c.lastStreamName = &newName
+ return nil
+}
+
+func (s basicMessagingSteps) thenStreamNameUpdated(ctx context.Context,
expectedName string) error {
+ c := getBasicMessagingCtx(ctx)
+ streamIdentifier, _ := iggcon.NewIdentifier(*c.lastStreamID)
+ stream, err := c.client.GetStream(streamIdentifier)
+ if err != nil {
+ return fmt.Errorf("failed to get stream: %w", err)
+ }
+ if stream.Name != expectedName {
+ return fmt.Errorf("expected stream name %s, got %s",
expectedName, stream.Name)
+ }
+ return nil
+}
+
+func (s basicMessagingSteps) whenDeleteStream(ctx context.Context) error {
+ c := getBasicMessagingCtx(ctx)
+ streamIdentifier, _ := iggcon.NewIdentifier(*c.lastStreamID)
+ if err := c.client.DeleteStream(streamIdentifier); err != nil {
+ return fmt.Errorf("failed to delete stream: %w", err)
+ }
+ c.lastStreamID = nil
+ return nil
+}
+
+func (s basicMessagingSteps) thenStreamDeletedSuccessfully(ctx
context.Context) error {
+ c := getBasicMessagingCtx(ctx)
+ if c.lastStreamID != nil {
+ return errors.New("stream ID should be nil after deletion")
+ }
+ return nil
+}
Review Comment:
I think it's better to call `GetStream` here to verify whether the stream is
actually deleted.
--
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]