Skip to content

Commit

Permalink
Add test sweeper for stream subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
thogarty committed Feb 15, 2025
1 parent 335ac9a commit 4eab6f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions internal/resources/fabric/stream/sweeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ func testSweepStreams(_ string) error {

for _, stream := range streams.GetData() {
if sweep.IsSweepableFabricTestResource(stream.GetName()) {
subscriptions, _, err := fabric.StreamSubscriptionsApi.GetStreamSubscriptions(ctx, stream.GetUuid()).Execute()
if err != nil {
errs = append(errs, fmt.Errorf("error getting fabric stream subscriptions on stream %s: %s", stream.GetUuid(), err))
}
for _, subscription := range subscriptions.GetData() {
log.Printf("[DEBUG] deleting stream subscription: %s", subscription.GetName())
_, resp, err := fabric.StreamSubscriptionsApi.DeleteStreamSubscriptionByUuid(ctx, stream.GetUuid(), subscription.GetUuid()).Execute()
if equinix_errors.IgnoreHttpResponseErrors(http.StatusForbidden, http.StatusNotFound)(resp, err) != nil {
errs = append(errs, fmt.Errorf("error deleting fabric stream subscription %s on stream %s: %s", subscription.GetUuid(), stream.GetUuid(), err))
}
}
log.Printf("[DEBUG] Deleting stream: %s", stream.GetName())
_, resp, err := fabric.StreamsApi.DeleteStreamByUuid(ctx, stream.GetUuid()).Execute()
if equinix_errors.IgnoreHttpResponseErrors(http.StatusForbidden, http.StatusNotFound)(resp, err) != nil {
Expand Down
1 change: 0 additions & 1 deletion internal/resources/fabric/stream_subscription/sweeper.go

This file was deleted.

0 comments on commit 4eab6f7

Please sign in to comment.