Skip to content

Commit

Permalink
[FIXED] OBJ_ prefix when listing object stores
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Piotrowski <piotr@synadia.com>
  • Loading branch information
piotrpio committed Dec 12, 2023
1 parent 30e50d3 commit eae2849
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion jetstream/object.go
Original file line number Diff line number Diff line change
Expand Up @@ -1218,7 +1218,7 @@ func (js *jetStream) ObjectStoreNames(ctx context.Context) ObjectStoreNamesListe
if !strings.HasPrefix(name, "OBJ_") {
continue
}
res.obsNames <- name
res.obsNames <- strings.TrimPrefix(name, "OBJ_")
}
if errors.Is(err, ErrEndOfData) {
return
Expand Down
4 changes: 4 additions & 0 deletions jetstream/test/object_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"path"
"path/filepath"
"reflect"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -975,6 +976,9 @@ func TestListObjectStores(t *testing.T) {
names := make([]string, 0)
objectStoreNames := js.ObjectStoreNames(ctx)
for name := range objectStoreNames.Name() {
if strings.HasPrefix(name, "OBJ_") {
t.Fatalf("Expected name without OBJ_ prefix, got: %s", name)
}
names = append(names, name)
}
expectOk(t, objectStoreNames.Error())
Expand Down

0 comments on commit eae2849

Please sign in to comment.