Skip to content

Commit

Permalink
fix: while import logger,db will create log dir cause TestColumn_List…
Browse files Browse the repository at this point in the history
…ColumnFamilies failed
  • Loading branch information
halalala222 committed Aug 12, 2024
1 parent 732ced0 commit 048e496
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion db/column/column_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/ByteStorage/FlyDB/config"
"github.com/ByteStorage/FlyDB/lib/wal"
"github.com/stretchr/testify/assert"
"io/ioutil"
"os"
"testing"
)
Expand Down Expand Up @@ -75,6 +76,15 @@ func TestColumn_ListColumnFamilies(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, column)

dirs, err := ioutil.ReadDir(option.DbMemoryOptions.Option.DirPath)
assert.Nil(t, err)
dirCount := 0
for _, dir := range dirs {
if dir.IsDir() {
dirCount++
}
}

err = column.CreateColumnFamily("test")
assert.Nil(t, err)

Expand All @@ -89,7 +99,7 @@ func TestColumn_ListColumnFamilies(t *testing.T) {

list, err := column.ListColumnFamilies()
assert.Nil(t, err)
assert.Equal(t, 4, len(list))
assert.Equal(t, dirCount+3, len(list))

err = column.DropColumnFamily("test")
assert.Nil(t, err)
Expand Down

0 comments on commit 048e496

Please sign in to comment.