mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-16 19:14:41 -07:00
@@ -694,7 +694,7 @@ func (s *Server) configAllJetStreamAccounts() error {
|
||||
// clustered stream removal will perform this cleanup as well
|
||||
// this is mainly for initial cleanup
|
||||
saccName := s.sys.account.Name
|
||||
accStoreDirs, _ := ioutil.ReadDir(js.config.StoreDir)
|
||||
accStoreDirs, _ := os.ReadDir(js.config.StoreDir)
|
||||
for _, acc := range accStoreDirs {
|
||||
if accName := acc.Name(); accName != saccName {
|
||||
// no op if not empty
|
||||
|
||||
@@ -23,7 +23,6 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math/rand"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -3784,10 +3783,10 @@ func TestJetStreamClusterAccountPurge(t *testing.T) {
|
||||
sysDirs := 0
|
||||
accDirs := 0
|
||||
for _, s := range c.servers {
|
||||
files, err := ioutil.ReadDir(s.getOpts().StoreDir + "/jetstream/" + syspub + "/_js_/")
|
||||
files, err := os.ReadDir(s.getOpts().StoreDir + "/jetstream/" + syspub + "/_js_/")
|
||||
require_NoError(t, err)
|
||||
sysDirs += len(files) - 1 // sub 1 for _meta_
|
||||
files, err = ioutil.ReadDir(s.getOpts().StoreDir + "/jetstream/" + accpub + "/streams/")
|
||||
files, err = os.ReadDir(s.getOpts().StoreDir + "/jetstream/" + accpub + "/streams/")
|
||||
if err == nil || (err != nil && err.(*os.PathError).Error() == "no such file or directory") {
|
||||
accDirs += len(files)
|
||||
}
|
||||
@@ -3932,10 +3931,10 @@ func TestJetStreamAccountPurge(t *testing.T) {
|
||||
inspectDirs := func(t *testing.T, accTotal int) error {
|
||||
t.Helper()
|
||||
if accTotal == 0 {
|
||||
files, err := ioutil.ReadDir(o.StoreDir + "/jetstream/" + accpub)
|
||||
files, err := os.ReadDir(o.StoreDir + "/jetstream/" + accpub)
|
||||
require_True(t, len(files) == accTotal || err != nil)
|
||||
} else {
|
||||
files, err := ioutil.ReadDir(o.StoreDir + "/jetstream/" + accpub + "/streams")
|
||||
files, err := os.ReadDir(o.StoreDir + "/jetstream/" + accpub + "/streams")
|
||||
require_NoError(t, err)
|
||||
require_True(t, len(files) == accTotal)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user