sourcenetwork / defradb

DefraDB is a Peer-to-Peer Edge Database. It's the core data storage system for the Source Network Ecosystem, built with IPLD, LibP2P, CRDTs, and Semantic open web properties.
444 stars 43 forks source link

Flaky `TestIndexCreate` cli integration test even without race. #1628

Closed shahzadlone closed 1 year ago

shahzadlone commented 1 year ago

Test command:

 gotestsum --format pkgname -- ./...

Output:

=== Failed
=== FAIL: tests/integration/cli TestIndexCreate_IfNoCollectionArg_ShouldFail (2.09s)
Created config file at /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/config.yaml
Starting DefraDB service...
Opening badger store
    utils.go:123: executing defra command with args [--url localhost:52043 client schema add -f /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/003/schema.graphql --rootdir /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/004]
    client_index_create_test.go:24: expected [""] to contain "success"

=== FAIL: tests/integration/cli TestIndexCreate_IfCollectionExists_ShouldCreateIndex (1.29s)
Created config file at /tmp/TestIndexCreate_IfCollectionExists_ShouldCreateIndex2309088202/001/config.yaml
Starting DefraDB service...
Opening badger store
    utils.go:123: executing defra command with args [--url localhost:53817 client schema add -f /tmp/TestIndexCreate_IfCollectionExists_ShouldCreateIndex2309088202/003/schema.graphql --rootdir /tmp/TestIndexCreate_IfCollectionExists_ShouldCreateIndex2309088202/004]
    client_index_create_test.go:24: expected [""] to contain "success"

=== FAIL: tests/integration/cli TestIndexCreate_IfInternalError_ShouldFail (unknown)
Created config file at /tmp/TestIndexCreate_IfInternalError_ShouldFail785618471/001/config.yaml
Starting DefraDB service...
Opening badger store
Starting P2P node
Started RPC server
Providing HTTP API at http://localhost:61190/api/v0. Use the GraphQL request endpoint at http://localhost:61190/api/v0/graphql
    utils.go:123: executing defra command with args [--url localhost:61190 client index create --collection User --fields Name --name users_name_index --rootdir /tmp/TestIndexCreate_IfInternalError_ShouldFail785618471/003]
2023-07-11T18:12:27.717-0400    ERROR   badger  v3@v3.2103.5/memtable.go:160    Got error: While opening memtable: /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/data/00001.mem error: while opening file: /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/data/00001.mem error: open /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/data/00001.mem: no such file or directory
unable to open: /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/data/00001.mem
github.com/dgraph-io/ristretto/z.OpenMmapFile
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/ristretto@v0.1.1/z/file.go:80
github.com/dgraph-io/badger/v3.(*logFile).open
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.5/memtable.go:556
github.com/dgraph-io/badger/v3.(*DB).openMemTable
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.5/memtable.go:130
github.com/dgraph-io/badger/v3.(*DB).newMemTable
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.5/memtable.go:153
github.com/dgraph-io/badger/v3.Open
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.5/db.go:338
github.com/sourcenetwork/defradb/datastore/badger/v3.NewDatastore
        /home/shahzad/~~/defradb/datastore/badger/v3/datastore.go:157
github.com/sourcenetwork/defradb/cli.start
        /home/shahzad/~~/defradb/cli/start.go:229
github.com/sourcenetwork/defradb/cli.MakeStartCommand.func2
        /home/shahzad/~~/defradb/cli/start.go:76
github.com/spf13/cobra.(*Command).execute
        /home/shahzad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940
github.com/spf13/cobra.(*Command).ExecuteC
        /home/shahzad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068
github.com/spf13/cobra.(*Command).ExecuteContextC
        /home/shahzad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1001
github.com/sourcenetwork/defradb/cli.(*DefraCommand).Execute
        /home/shahzad/~~/defradb/cli/cli.go:116
github.com/sourcenetwork/defradb/tests/integration/cli.runDefraNode.func1
        /home/shahzad/~~/defradb/tests/integration/cli/utils.go:93
runtime.goexit
        /home/shahzad/.local/bin/go1.19.5/src/runtime/asm_amd64.s:1594 for id: 1

2023-07-11T18:12:27.717-0400    ERROR   badger  v3@v3.2103.5/db.go:261  Received err: newMemTable error: While opening memtable: /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/data/00001.mem error: while opening file: /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/data/00001.mem error: open /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/data/00001.mem: no such file or directory
unable to open: /tmp/TestIndexCreate_IfNoCollectionArg_ShouldFail4127537412/001/data/00001.mem
github.com/dgraph-io/ristretto/z.OpenMmapFile
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/ristretto@v0.1.1/z/file.go:80
github.com/dgraph-io/badger/v3.(*logFile).open
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.5/memtable.go:556
github.com/dgraph-io/badger/v3.(*DB).openMemTable
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.5/memtable.go:130
github.com/dgraph-io/badger/v3.(*DB).newMemTable
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.5/memtable.go:153
github.com/dgraph-io/badger/v3.Open
        /home/shahzad/go/pkg/mod/github.com/dgraph-io/badger/v3@v3.2103.5/db.go:338
github.com/sourcenetwork/defradb/datastore/badger/v3.NewDatastore
        /home/shahzad/~~/defradb/datastore/badger/v3/datastore.go:157
github.com/sourcenetwork/defradb/cli.start
        /home/shahzad/~~/defradb/cli/start.go:229
github.com/sourcenetwork/defradb/cli.MakeStartCommand.func2
        /home/shahzad/~~/defradb/cli/start.go:76
github.com/spf13/cobra.(*Command).execute
        /home/shahzad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:940
github.com/spf13/cobra.(*Command).ExecuteC
        /home/shahzad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068
github.com/spf13/cobra.(*Command).ExecuteContextC
        /home/shahzad/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1001
github.com/sourcenetwork/defradb/cli.(*DefraCommand).Execute
        /home/shahzad/~~/defradb/cli/cli.go:116
github.com/sourcenetwork/defradb/tests/integration/cli.runDefraNode.func1
        /home/shahzad/~~/defradb/tests/integration/cli/utils.go:93
runtime.goexit
        /home/shahzad/.local/bin/go1.19.5/src/runtime/asm_amd64.s:1594. Cleaning up...
Execution error
panic: Fail in goroutine after TestIndexCreate_IfNoCollectionArg_ShouldFail has completed

goroutine 1686 [running]:
testing.(*common).Fail(0xc0000e8ea0)
        /home/shahzad/.local/bin/go1.19.5/src/testing/testing.go:824 +0xe5
testing.(*common).Errorf(0xc0000e8ea0, {0x1874f72?, 0xc0000e8ea0?}, {0xc003cb4330?, 0x47ba25?, 0x28d9620?})
        /home/shahzad/.local/bin/go1.19.5/src/testing/testing.go:941 +0x65
github.com/stretchr/testify/assert.Fail({0x1d4ba80, 0xc0000e8ea0}, {0xc00084ec80, 0xc3f}, {0x0, 0x0, 0x0})
        /home/shahzad/go/pkg/mod/github.com/stretchr/testify@v1.8.4/assert/assertions.go:333 +0x384
github.com/stretchr/testify/assert.NoError({0x1d4ba80, 0xc0000e8ea0}, {0x1d496e0, 0xc000bed400}, {0x0, 0x0, 0x0})
        /home/shahzad/go/pkg/mod/github.com/stretchr/testify@v1.8.4/assert/assertions.go:1495 +0x105
github.com/sourcenetwork/defradb/tests/integration/cli.runDefraNode.func1()
        /home/shahzad/~~/defradb/tests/integration/cli/utils.go:94 +0x185
created by github.com/sourcenetwork/defradb/tests/integration/cli.runDefraNode
        /home/shahzad/~~/defradb/tests/integration/cli/utils.go:88 +0x4e5
nasdf commented 1 year ago

closed by #1839