Merged in feature/serviceconfig-integration (pull request #38)
DRAFT PR : WIP working through ideas for integration * movearound * attempttwo * openapi * further sanding * fix * start on tests * runthroughsingleconfig * somechanges * reflectissue * removeerrs * mostlyremovepanic * removeenv * noncfgtests * go * repo * fix service config test * add PWD to all * test fix * fix lint * todo for later * passingunittests * alltests * testlogger * testloggername * clean
This commit is contained in:
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/test"
|
||||
"testing"
|
||||
|
||||
@@ -14,13 +14,19 @@ import (
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
id, err := queries.CreateClient(ctx, "example_client")
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/test"
|
||||
"testing"
|
||||
|
||||
@@ -16,13 +17,19 @@ import (
|
||||
|
||||
func TestCollector(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
contextId, err := queries.CreateQuery(ctx, repository.QuerytypeContextFull)
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/test"
|
||||
"testing"
|
||||
|
||||
@@ -14,13 +14,19 @@ import (
|
||||
|
||||
func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
clientId, err := queries.CreateClient(ctx, "example_client")
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/test"
|
||||
"testing"
|
||||
|
||||
@@ -14,13 +14,18 @@ import (
|
||||
|
||||
func TestJob(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
clientId, err := queries.CreateClient(ctx, "example_client")
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/test"
|
||||
"testing"
|
||||
|
||||
@@ -16,14 +17,18 @@ import (
|
||||
|
||||
func TestQueries(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
contextQueryID, err := queries.CreateQuery(ctx, repository.Querytype(repository.QuerytypeContextFull))
|
||||
assert.Nil(t, err)
|
||||
@@ -162,13 +167,18 @@ func TestQueries(t *testing.T) {
|
||||
func TestQueryDependencyTree(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
contextQueryID, err := queries.CreateQuery(ctx, repository.Querytype(repository.QuerytypeContextFull))
|
||||
assert.Nil(t, err)
|
||||
@@ -230,13 +240,18 @@ func TestQueryDependencyTree(t *testing.T) {
|
||||
func TestQueriesList(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: "../../..",
|
||||
}})
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
contextQueryID, err := queries.CreateQuery(ctx, repository.Querytype(repository.QuerytypeContextFull))
|
||||
assert.Nil(t, err)
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"context"
|
||||
"os"
|
||||
"path"
|
||||
"queryorchestration/internal/database"
|
||||
"queryorchestration/internal/database/repository"
|
||||
"queryorchestration/internal/serviceconfig"
|
||||
"queryorchestration/internal/test"
|
||||
"testing"
|
||||
|
||||
@@ -16,13 +16,18 @@ import (
|
||||
func TestResults(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
jsonQueryID, err := queries.CreateQuery(ctx, repository.Querytype(repository.QuerytypeJsonExtractor))
|
||||
assert.Nil(t, err)
|
||||
@@ -72,13 +77,18 @@ func TestResults(t *testing.T) {
|
||||
func TestResultValues(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
jsonQueryID, err := queries.CreateQuery(ctx, repository.Querytype(repository.QuerytypeJsonExtractor))
|
||||
assert.Nil(t, err)
|
||||
@@ -167,13 +177,18 @@ func TestResultValues(t *testing.T) {
|
||||
func TestUnsyncedQueries(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
db, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Migrations: &database.MigrationConfig{
|
||||
BasePath: path.Join(os.Getenv("PWD"), "../../.."),
|
||||
}})
|
||||
t.Setenv("BASE_PATH", path.Join(os.Getenv("PWD"), "../../.."))
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
err := serviceconfig.InitializeConfig(cfg)
|
||||
assert.Nil(t, err)
|
||||
|
||||
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
|
||||
Cfg: cfg,
|
||||
RunMigrations: true,
|
||||
})
|
||||
defer cleanup()
|
||||
|
||||
queries := repository.New(db.Pool)
|
||||
queries := cfg.DBQueries
|
||||
|
||||
clientId, err := queries.CreateClient(ctx, "example_client")
|
||||
assert.Nil(t, err)
|
||||
|
||||
Reference in New Issue
Block a user