yowcow / goromdb

Yet another single process KVS server implemented over file-based database
The Unlicense
12 stars 5 forks source link

make test failed: data files not found #53

Closed suzuken closed 6 years ago

suzuken commented 6 years ago
-> % make test
go test ./...
ok      github.com/yowcow/goromdb       0.012s [no tests to run]
?       github.com/yowcow/goromdb/cmd/sample-data/bdb   [no test files]
?       github.com/yowcow/goromdb/cmd/sample-data/memcachedb-bdb        [no test files]
?       github.com/yowcow/goromdb/handler       [no test files]
--- FAIL: TestLoadAndGet (0.00s)
        Error Trace:    radixhandler_test.go:36
        Error:          Expected nil, but got: &os.PathError{Op:"open", Path:"../../data/store/sample-data.json", Err:0x2}
    --- FAIL: TestLoadAndGet/exact_match_on_key_succeeds (0.00s)
        Error Trace:    radixhandler_test.go:72
        Error:          Not equal:
                        expected: false
                        received: true
        Error Trace:    radixhandler_test.go:73
        Error:          Not equal:
                        expected: []byte{0x68, 0x6f, 0x67, 0x65}
                        received: []byte(nil)

                        Diff:
                        --- Expected
                        +++ Actual
                        @@ -1,4 +1,2 @@
                        -([]uint8) (len=4) {
                        - 00000000  68 6f 67 65                                       |hoge|
                        -}
                        +([]uint8) <nil>

        Error Trace:    radixhandler_test.go:74
        Error:          Not equal:
                        expected: []byte{0x68, 0x6f, 0x67, 0x65, 0x21}
                        received: []byte(nil)

                        Diff:
                        --- Expected
                        +++ Actual
                        @@ -1,4 +1,2 @@
                        -([]uint8) (len=5) {
                        - 00000000  68 6f 67 65 21                                    |hoge!|
                        -}
                        +([]uint8) <nil>

    --- FAIL: TestLoadAndGet/prefix_match_on_key_succeeds (0.00s)
        Error Trace:    radixhandler_test.go:72
        Error:          Not equal:
                        expected: false
                        received: true
        Error Trace:    radixhandler_test.go:73
        Error:          Not equal:
                        expected: []byte{0x68, 0x6f, 0x67, 0x65}
                        received: []byte(nil)

                        Diff:
                        --- Expected
                        +++ Actual
                        @@ -1,4 +1,2 @@
                        -([]uint8) (len=4) {
                        - 00000000  68 6f 67 65                                       |hoge|
                        -}
                        +([]uint8) <nil>

        Error Trace:    radixhandler_test.go:74
        Error:          Not equal:
                        expected: []byte{0x68, 0x6f, 0x67, 0x65, 0x21}
                        received: []byte(nil)

                        Diff:
                        --- Expected
                        +++ Actual
                        @@ -1,4 +1,2 @@
                        -([]uint8) (len=5) {
                        - 00000000  68 6f 67 65 21                                    |hoge!|
                        -}
                        +([]uint8) <nil>

--- FAIL: TestStart (0.00s)
panic: open ../../data/store/sample-data.json: no such file or directory [recovered]
        panic: open ../../data/store/sample-data.json: no such file or directory

goroutine 10 [running]:
testing.tRunner.func1(0xc42010e960)
        /Users/ke-suzuki/src/github.com/golang/go/src/testing/testing.go:739 +0x291
panic(0x1297180, 0xc4201602d0)
        /Users/ke-suzuki/src/github.com/golang/go/src/runtime/panic.go:502 +0x229
github.com/yowcow/goromdb/testutil.CopyFile(0xc4200194f0, 0x50, 0x12f2eb7, 0x21)
        /Users/ke-suzuki/src/github.com/yowcow/goromdb/testutil/testutil.go:28 +0x178
github.com/yowcow/goromdb/handler/radixhandler.TestStart(0xc42010e960)
        /Users/ke-suzuki/src/github.com/yowcow/goromdb/handler/radixhandler/radixhandler_test.go:95 +0x2c3
testing.tRunner(0xc42010e960, 0x12fe388)
        /Users/ke-suzuki/src/github.com/golang/go/src/testing/testing.go:774 +0xc4
created by testing.(*T).Run
        /Users/ke-suzuki/src/github.com/golang/go/src/testing/testing.go:821 +0x2ca
FAIL    github.com/yowcow/goromdb/handler/radixhandler  0.046s
ok      github.com/yowcow/goromdb/handler/simplehandler (cached)
ok      github.com/yowcow/goromdb/loader        (cached)
ok      github.com/yowcow/goromdb/protocol      (cached)
ok      github.com/yowcow/goromdb/protocol/memcachedprotocol    (cached)
ok      github.com/yowcow/goromdb/server        (cached)
?       github.com/yowcow/goromdb/storage       [no test files]
BDB0134 read: 0x7fff5fbfeda0, 512: Is a directory
./: Is a directory
--- FAIL: TestLoad (0.00s)
    --- FAIL: TestLoad/loading_valid_file_succeeds (0.00s)
        Error Trace:    bdbstorage_test.go:43
        Error:          Not equal:
                        expected: false
                        received: true
--- FAIL: TestGet (0.00s)
    --- FAIL: TestGet/existing_key_returns_expected_val (0.00s)
        Error Trace:    bdbstorage_test.go:88
        Error:          Not equal:
                        expected: false
                        received: true
        Error Trace:    bdbstorage_test.go:89
        Error:          Not equal:
                        expected: []byte{0x68, 0x6f, 0x67, 0x65, 0x21}
                        received: []byte(nil)

                        Diff:
                        --- Expected
                        +++ Actual
                        @@ -1,4 +1,2 @@
                        -([]uint8) (len=5) {
                        - 00000000  68 6f 67 65 21                                    |hoge!|
                        -}
                        +([]uint8) <nil>

    --- FAIL: TestGet/existing_key_again_returns_expected_val (0.00s)
        Error Trace:    bdbstorage_test.go:88
        Error:          Not equal:
                        expected: false
                        received: true
        Error Trace:    bdbstorage_test.go:89
        Error:          Not equal:
                        expected: []byte{0x68, 0x6f, 0x67, 0x65, 0x21}
                        received: []byte(nil)

                        Diff:
                        --- Expected
                        +++ Actual
                        @@ -1,4 +1,2 @@
                        -([]uint8) (len=5) {
                        - 00000000  68 6f 67 65 21                                    |hoge!|
                        -}
                        +([]uint8) <nil>

FAIL
FAIL    github.com/yowcow/goromdb/storage/bdbstorage    0.016s
ok      github.com/yowcow/goromdb/storage/jsonstorage   (cached)
BDB0134 read: 0x7fff5fbfeda0, 512: Is a directory
./: Is a directory
--- FAIL: TestLoad (0.00s)
    --- FAIL: TestLoad/loading_existing_file_succeeds (0.00s)
        Error Trace:    memcdstorage_test.go:46
        Error:          Not equal:
                        expected: false
                        received: true
--- FAIL: TestGet (0.00s)
    --- FAIL: TestGet/existing_key_succeeds (0.00s)
        Error Trace:    memcdstorage_test.go:92
        Error:          Not equal:
                        expected: false
                        received: true
        Error Trace:    memcdstorage_test.go:93
        Error:          Not equal:
                        expected: []byte{0x68, 0x6f, 0x67, 0x65, 0x21}
                        received: []byte(nil)

                        Diff:
                        --- Expected
                        +++ Actual
                        @@ -1,4 +1,2 @@
                        -([]uint8) (len=5) {
                        - 00000000  68 6f 67 65 21                                    |hoge!|
                        -}
                        +([]uint8) <nil>

    --- FAIL: TestGet/existing_key_again_succeeds (0.00s)
        Error Trace:    memcdstorage_test.go:92
        Error:          Not equal:
                        expected: false
                        received: true
        Error Trace:    memcdstorage_test.go:93
        Error:          Not equal:
                        expected: []byte{0x68, 0x6f, 0x67, 0x65, 0x21}
                        received: []byte(nil)

                        Diff:
                        --- Expected
                        +++ Actual
                        @@ -1,4 +1,2 @@
                        -([]uint8) (len=5) {
                        - 00000000  68 6f 67 65 21                                    |hoge!|
                        -}
                        +([]uint8) <nil>

FAIL
FAIL    github.com/yowcow/goromdb/storage/memcdstorage  0.020s
ok      github.com/yowcow/goromdb/testutil      (cached)
ok      github.com/yowcow/goromdb/watcher       (cached)
make: *** [test] Error 1
suzuken commented 6 years ago

@yowcow Can I fix this? testdata is recommended to place data files for testing. see: https://golang.org/cmd/go/#hdr-Test_packages

suzuken commented 6 years ago
-> % go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/ke-suzuki/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/ke-suzuki"
GORACE=""
GOROOT="/Users/ke-suzuki/src/github.com/golang/go"
GOTMPDIR=""
GOTOOLDIR="/Users/ke-suzuki/src/github.com/golang/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/r3/sfzv3qpn2x1gh9g1g2dk5xh90g5vzc/T/go-build136053941=/tmp/go-build -gno-record-gcc-switches -fno-common"
suzuken commented 6 years ago

@yowcow Could you provide sample-bdb.db for testing? Thanks

suzuken commented 6 years ago

Running make required before make test. Close.