mirror of
https://github.com/gogs/gogs.git
synced 2026-02-27 16:50:58 +01:00
29 lines
635 B
Go
29 lines
635 B
Go
package embeddedpg
|
|
|
|
import (
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestInitialize(t *testing.T) {
|
|
workDir := "/tmp/gogs-test"
|
|
pg := Initialize(workDir)
|
|
|
|
assert.NotNil(t, pg)
|
|
assert.Equal(t, filepath.Join(workDir, "data", "local-postgres"), pg.baseDir)
|
|
assert.Equal(t, uint32(15432), pg.tcpPort)
|
|
assert.Equal(t, "gogs", pg.database)
|
|
assert.Equal(t, "gogs", pg.user)
|
|
assert.Equal(t, "gogs", pg.pass)
|
|
}
|
|
|
|
func TestShutdownWithoutStart(t *testing.T) {
|
|
pg := Initialize("/tmp/gogs-test")
|
|
|
|
// Should not error when stopping a non-started instance
|
|
err := pg.Shutdown()
|
|
assert.NoError(t, err)
|
|
}
|