7001ca854c
Queuing Changes and Cfg Testing * staarting * staarting * startedpush * note * save * mocking * removederrs * fixtests * cleanuperrs * newenvsetup * preppingtests * queue * mmovetocfgpassunittests * sortoutconfig * passinginteg * deps * fixtests
41 lines
792 B
Go
41 lines
792 B
Go
package server_test
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"os"
|
|
"path"
|
|
"queryorchestration/internal/server"
|
|
"queryorchestration/internal/test"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNew(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("Skipping long test in short mode")
|
|
}
|
|
ctx := context.Background()
|
|
|
|
sccfg := test.CreateBaseConfig()
|
|
sccfg.BasePath = path.Join(os.Getenv("PWD"), "../..")
|
|
cfg := &server.BaseConfig{
|
|
BaseConfig: *sccfg,
|
|
}
|
|
|
|
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
|
Cfg: cfg,
|
|
})
|
|
defer cleanup()
|
|
|
|
clean, err := server.New(ctx, cfg)
|
|
assert.NoError(t, err)
|
|
defer func() {
|
|
if err := clean(); err != nil {
|
|
// Log cleanup error but don't panic since we're shutting down
|
|
fmt.Printf("Error during clean: %v", err)
|
|
}
|
|
}()
|
|
}
|