mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00

* chore: refactor: inject sqlx.DB into opamp.initDB instead of DB file name * chore: reorganize test utils a little * chore: add test validating pipelines for installed integrations show up in pipelines list * chore: get basic integration pipelines testcase passing * chore: reconcile experimental changes with latest state of develop * chore: add integration test for reordering of pipelines * chore: marker for integration pipelines using Id * chore: hookup propagation of installed integration pipelines by opamp * chore: add util for mapping slices * chore: add support for reordering integration pipelines * chore: exclude user saved integration pipelines if no longer installed * chore: flesh out rest of intgeration pipelines scenarios * chore: handle scenario when an integration is installed before any pipelines exist * chore: notify agentConf of update after uninstalling an integration * chore: some minor cleanup * chore: some more cleanup * chore: update ee server for changed controllers * chore: some more cleanup * chore: change builtin integration id prefix to avoid using colons that break yaml * chore: update builtin integration id in test
30 lines
676 B
Go
30 lines
676 B
Go
package utils
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/jmoiron/sqlx"
|
|
"go.signoz.io/signoz/pkg/query-service/dao"
|
|
)
|
|
|
|
func NewQueryServiceDBForTests(t *testing.T) *sqlx.DB {
|
|
testDBFile, err := os.CreateTemp("", "test-signoz-db-*")
|
|
if err != nil {
|
|
t.Fatalf("could not create temp file for test db: %v", err)
|
|
}
|
|
testDBFilePath := testDBFile.Name()
|
|
t.Cleanup(func() { os.Remove(testDBFilePath) })
|
|
testDBFile.Close()
|
|
|
|
testDB, err := sqlx.Open("sqlite3", testDBFilePath)
|
|
if err != nil {
|
|
t.Fatalf("could not open test db sqlite file: %v", err)
|
|
}
|
|
|
|
// TODO(Raj): This should not require passing in the DB file path
|
|
dao.InitDao("sqlite", testDBFilePath)
|
|
|
|
return testDB
|
|
}
|