1
0
mirror of https://github.com/taigrr/bitcask synced 2025-01-18 04:03:17 -08:00

Added test harness logic to skip some tests on Windows (#129)

This commit is contained in:
James Mills 2020-01-26 07:31:58 +10:00 committed by GitHub
parent cae49b3319
commit 45c81452c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,6 +8,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"reflect" "reflect"
"runtime"
"sort" "sort"
"strings" "strings"
"sync" "sync"
@ -50,6 +51,12 @@ func SortByteArrays(src [][]byte) [][]byte {
return sorted return sorted
} }
func skipIfWindows(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("Skipping this test on Windows")
}
}
func TestAll(t *testing.T) { func TestAll(t *testing.T) {
var ( var (
db *Bitcask db *Bitcask
@ -154,7 +161,7 @@ func TestDeleteAll(t *testing.T) {
func TestReopen1(t *testing.T) { func TestReopen1(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
for i := 0; i < 10; i ++ { for i := 0; i < 10; i++ {
testdir, _ := ioutil.TempDir("", "bitcask") testdir, _ := ioutil.TempDir("", "bitcask")
db, _ := Open(testdir, WithMaxDatafileSize(1)) db, _ := Open(testdir, WithMaxDatafileSize(1))
_ = db.Put([]byte("foo"), []byte("bar")) _ = db.Put([]byte("foo"), []byte("bar"))
@ -616,6 +623,10 @@ func TestStatsError(t *testing.T) {
assert.Equal(stats.Datafiles, 0) assert.Equal(stats.Datafiles, 0)
assert.Equal(stats.Keys, 1) assert.Equal(stats.Keys, 1)
}) })
})
t.Run("Test", func(t *testing.T) {
skipIfWindows(t)
t.Run("FabricatedDestruction", func(t *testing.T) { t.Run("FabricatedDestruction", func(t *testing.T) {
// This would never happen in reality :D // This would never happen in reality :D
@ -997,6 +1008,8 @@ func TestMergeErrors(t *testing.T) {
assert := assert.New(t) assert := assert.New(t)
t.Run("RemoveDatabaseDirectory", func(t *testing.T) { t.Run("RemoveDatabaseDirectory", func(t *testing.T) {
skipIfWindows(t)
testdir, err := ioutil.TempDir("", "bitcask") testdir, err := ioutil.TempDir("", "bitcask")
assert.NoError(err) assert.NoError(err)
defer os.RemoveAll(testdir) defer os.RemoveAll(testdir)