tursodatabase / libsql-shell-go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix: TestRootCommandShellSuite_WhenDbIsSqld fails when running against either local or remote sqld database

douglasmdev opened this issue · comments

Steps to reproduce

  1. cp .test_config.yaml.example .test_config.yaml
  2. set sqld_db_path: "<db_url>" replacing <db_url> with the url to your local or remote db
  3. make sure skip_sqld_tests is set to false
  4. go test -v ./...

The failing portion of the log should be:

=== RUN   TestRootCommandShellSuite_WhenDbIsSqld
    suite.go:87: test panicked: runtime error: invalid memory address or nil pointer dereference
        goroutine 1259 [running]:
        runtime/debug.Stack()
                /usr/local/go/src/runtime/debug/stack.go:24 +0x65
        github.com/stretchr/testify/suite.failOnPanic(0xc001a03860, {0xd0e1a0, 0x15292f0})
                <go_mod_dir>/github.com/stretchr/testify@v1.8.2/suite/suite.go:87 +0x3b
        github.com/stretchr/testify/suite.recoverAndFailOnPanic(0x10?)
                <go_mod_dir>/github.com/stretchr/testify@v1.8.2/suite/suite.go:82 +0x36
        panic({0xd0e1a0, 0x15292f0})
                /usr/local/go/src/runtime/panic.go:884 +0x213
        github.com/libsql/libsql-shell-go/internal/shell.(*Shell).newReadline(0xc0000c9b80)
                <project_root>/internal/shell/shell.go:160 +0x32
        github.com/libsql/libsql-shell-go/internal/shell.(*Shell).resetState(0xc0000c9b80)
                <project_root>/internal/shell/shell.go:124 +0x25
        github.com/libsql/libsql-shell-go/internal/shell.NewShell({{0xf07fa0, 0xc001a9eed0}, {0xf07fe0, 0xc001a9ee70}, {0xf07fe0, 0xc001a9eea0}, 0x0, {0x0, 0x0}, 0x1, ...}, ...)
                <project_root>/internal/shell/shell.go:70 +0x309
        github.com/libsql/libsql-shell-go/test/utils.(*DbTestContext).ExecuteShell(0xc001a9ee40, {0xc0000d9cf0?, 0xc000076c00?, 0xc001a9ee40?})
                <project_root>/test/utils/db_test_context.go:55 +0x11b

Wherein <project_root> and <go_mod_dir> are dependent on your setup.

Done