Merged in feature/momocks (pull request #150)
Decrease Mocks * feature/nomocks * nonet * assertsaws * assert
This commit is contained in:
@@ -20,8 +20,7 @@ func TestClean(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
|
||||
@@ -20,8 +20,7 @@ func TestClientQueries(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
|
||||
@@ -22,8 +22,7 @@ func TestCollector(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -225,8 +224,7 @@ func BenchmarkListCollectorQueries(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(b)
|
||||
test.CreateDB(b, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -248,8 +246,7 @@ func BenchmarkGetCollectorByClientID(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(b)
|
||||
test.CreateDB(b, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -42,8 +41,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -73,8 +71,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -109,8 +106,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -156,8 +152,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -189,8 +184,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -223,8 +217,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -255,8 +248,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -297,8 +289,7 @@ func TestDocument(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ func TestQueries(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -231,8 +230,7 @@ func TestQueryDependencyTree(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -450,8 +448,7 @@ func TestQueriesList(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -506,8 +503,7 @@ func TestListQueryClients(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -595,8 +591,7 @@ func BenchmarkListQueryDirectDependentsByDocId(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(b)
|
||||
test.CreateDB(b, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ func TestResults(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -51,8 +50,7 @@ func TestResultValues(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -266,8 +264,7 @@ func TestUnsyncedNoDepsQueries(t *testing.T) {
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -382,8 +379,7 @@ func TestUnsyncedNoDepsQueries(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -479,8 +475,7 @@ func TestUnsyncedNoDepsQueries(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -507,8 +502,7 @@ func BenchmarkListUnsynced(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(b)
|
||||
test.CreateDB(b, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ func TestListClientDocumentIDs(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -201,8 +200,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -223,8 +221,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -253,8 +250,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -289,8 +285,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -326,8 +321,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -369,8 +363,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -410,8 +403,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -441,8 +433,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -472,8 +463,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -517,8 +507,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -578,8 +567,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -617,8 +605,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -664,8 +651,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -706,8 +692,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -774,8 +759,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -800,8 +784,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -832,8 +815,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -864,8 +846,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -903,8 +884,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -934,8 +914,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -964,8 +943,7 @@ func TestClientSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -1127,8 +1105,7 @@ func BenchmarkIsClientSynced(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(b)
|
||||
test.CreateDB(b, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -1147,8 +1124,7 @@ func BenchmarkGetDocumentExternal(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(b)
|
||||
test.CreateDB(b, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
|
||||
@@ -23,8 +23,7 @@ func TestTextExtraction(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -131,8 +130,7 @@ func TestTextTextractPart(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
@@ -261,8 +259,7 @@ func TestTextOutPart(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
queries := cfg.GetDBQueries()
|
||||
|
||||
|
||||
@@ -56,8 +56,7 @@ func TestGet(t *testing.T) {
|
||||
func TestGetWithVersion(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
|
||||
Clientid: "client_id",
|
||||
|
||||
@@ -34,8 +34,7 @@ func TestGetValueWithVersion(t *testing.T) {
|
||||
t.Run("no entry", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
svc := New(cfg, &Services{})
|
||||
|
||||
@@ -52,8 +51,7 @@ func TestGetValueWithVersion(t *testing.T) {
|
||||
t.Run("existing entry", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
svc := New(cfg, &Services{})
|
||||
|
||||
@@ -148,8 +146,7 @@ func TestGetValueWithVersion(t *testing.T) {
|
||||
t.Run("not existing version", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
svc := New(cfg, &Services{})
|
||||
|
||||
|
||||
@@ -22,8 +22,7 @@ import (
|
||||
func TestProcess(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{
|
||||
Clientid: "client_id",
|
||||
|
||||
@@ -28,8 +28,7 @@ func TestNewAPI(t *testing.T) {
|
||||
|
||||
cfg := &BaseConfig{}
|
||||
_ = serviceconfig.InitializeConfig(cfg)
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{
|
||||
test.CreateDBWithParams(t, cfg, &test.CreateDatabaseConfig{
|
||||
NoMigrations: true,
|
||||
})
|
||||
|
||||
|
||||
@@ -28,13 +28,12 @@ func TestNewRunner(t *testing.T) {
|
||||
}
|
||||
cfg := &TestConfig{}
|
||||
_ = serviceconfig.InitializeConfig(cfg)
|
||||
net := test.GetNetwork(t)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{
|
||||
test.CreateDBWithParams(t, cfg, &test.CreateDatabaseConfig{
|
||||
NoMigrations: true,
|
||||
})
|
||||
|
||||
@@ -44,10 +43,10 @@ func TestNewRunner(t *testing.T) {
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
a := test.CreateAWSContainer(t, cfg, net)
|
||||
a := test.CreateAWSContainer(t, cfg)
|
||||
test.SetQueueClient(t, t.Context(), cfg, a.ExternalEndpoint)
|
||||
|
||||
cfg.QueueURL = test.CreateQueue(t, t.Context(), cfg, "queueName")
|
||||
cfg.QueueURL = test.CreateQueue(t, cfg, "queueName")
|
||||
cfg.SetSQSEndpoint(a.ExternalEndpoint)
|
||||
|
||||
wg.Wait()
|
||||
|
||||
@@ -22,9 +22,8 @@ func TestNewServer(t *testing.T) {
|
||||
|
||||
cfg := &server.BaseConfig{}
|
||||
_ = serviceconfig.InitializeConfig(cfg)
|
||||
net := test.GetNetwork(t)
|
||||
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{
|
||||
test.CreateDBWithParams(t, cfg, &test.CreateDatabaseConfig{
|
||||
NoMigrations: true,
|
||||
})
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ func TestSetDBPool(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
err := cfg.SetDBPool(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -17,8 +17,7 @@ func TestExecuteTransaction(t *testing.T) {
|
||||
t.Run("create client", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
err := cfg.ExecuteDBTransaction(t.Context(), func(ctx context.Context, q *repository.Queries) error {
|
||||
err := q.CreateClient(ctx, &repository.CreateClientParams{
|
||||
@@ -39,8 +38,7 @@ func TestExecuteTransaction(t *testing.T) {
|
||||
t.Run("error in transaction", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
net := test.GetNetwork(t)
|
||||
test.CreateDB(t, cfg, net, &test.CreateDatabaseConfig{})
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
err := cfg.ExecuteDBTransaction(t.Context(), func(ctx context.Context, q *repository.Queries) error {
|
||||
err := q.CreateClient(ctx, &repository.CreateClientParams{
|
||||
|
||||
@@ -95,8 +95,7 @@ func TestCalculateAndCompareETag(t *testing.T) {
|
||||
|
||||
cfg := &StoreConfig{}
|
||||
|
||||
net := test.GetNetwork(t)
|
||||
acfg := test.CreateAWSContainer(t, cfg, net)
|
||||
acfg := test.CreateAWSContainer(t, cfg)
|
||||
test.SetStoreClient(t, ctx, cfg, acfg.ExternalEndpoint)
|
||||
test.CreateBucket(t, ctx, cfg)
|
||||
|
||||
|
||||
@@ -7,16 +7,27 @@ import (
|
||||
)
|
||||
|
||||
type ReceiveParams struct {
|
||||
QueueURL string
|
||||
Attributes []string
|
||||
QueueURL string
|
||||
Attributes []string
|
||||
VisibilityTimeout int32
|
||||
WaitTimeSeconds int32
|
||||
}
|
||||
|
||||
func (c *QueueConfig) ReceiveFromQueue(ctx context.Context, params *ReceiveParams) (*sqs.ReceiveMessageOutput, error) {
|
||||
return c.QueueClient.ReceiveMessage(ctx, &sqs.ReceiveMessageInput{
|
||||
p := &sqs.ReceiveMessageInput{
|
||||
QueueUrl: ¶ms.QueueURL,
|
||||
MaxNumberOfMessages: 1,
|
||||
WaitTimeSeconds: 10,
|
||||
VisibilityTimeout: 10,
|
||||
MessageAttributeNames: params.Attributes,
|
||||
})
|
||||
}
|
||||
|
||||
if params.VisibilityTimeout > 0 {
|
||||
p.VisibilityTimeout = params.VisibilityTimeout
|
||||
}
|
||||
if params.WaitTimeSeconds > 0 {
|
||||
p.WaitTimeSeconds = params.WaitTimeSeconds
|
||||
}
|
||||
|
||||
return c.QueueClient.ReceiveMessage(ctx, p)
|
||||
}
|
||||
|
||||
@@ -30,10 +30,12 @@ const (
|
||||
awsPort = 4566
|
||||
)
|
||||
|
||||
func CreateAWSContainer(t testing.TB, cfg AWSConfigProvider, network string) *AWSContainerConfig {
|
||||
func CreateAWSContainer(t testing.TB, cfg AWSConfigProvider) *AWSContainerConfig {
|
||||
port, err := nat.NewPort("tcp", strconv.Itoa(awsPort))
|
||||
require.NoError(t, err)
|
||||
|
||||
network := GetNetwork(t)
|
||||
|
||||
cfg.SetAWSKeyID("test")
|
||||
cfg.SetAWSSecretKey("test")
|
||||
cfg.SetAWSSessionToken("")
|
||||
|
||||
@@ -23,7 +23,11 @@ const (
|
||||
dbPort = 5432
|
||||
)
|
||||
|
||||
func CreateDB(t testing.TB, cfg serviceconfig.ConfigProvider, network string, dcfg *CreateDatabaseConfig) {
|
||||
func CreateDB(t testing.TB, cfg serviceconfig.ConfigProvider) {
|
||||
CreateDBWithParams(t, cfg, &CreateDatabaseConfig{})
|
||||
}
|
||||
|
||||
func CreateDBWithParams(t testing.TB, cfg serviceconfig.ConfigProvider, dcfg *CreateDatabaseConfig) {
|
||||
port, err := nat.NewPort("tcp", strconv.Itoa(dbPort))
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -32,6 +36,8 @@ func CreateDB(t testing.TB, cfg serviceconfig.ConfigProvider, network string, dc
|
||||
cfg.SetDBName(GetAlias(t, "postgres"))
|
||||
cfg.SetDBNoSSL(true)
|
||||
|
||||
network := GetNetwork(t)
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "postgres:17.2-alpine3.21",
|
||||
Name: "postgres_test_queryorchestration",
|
||||
|
||||
@@ -136,7 +136,7 @@ func CreateFullDependenciesWithParams(t testing.TB, cfg FullDependenciesConfig,
|
||||
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
deps.AWSConfig = CreateAWSContainer(t, cfg, network)
|
||||
deps.AWSConfig = CreateAWSContainer(t, cfg)
|
||||
|
||||
SetQueueClient(t, t.Context(), cfg, deps.AWSConfig.ExternalEndpoint)
|
||||
|
||||
@@ -154,7 +154,7 @@ func CreateFullDependenciesWithParams(t testing.TB, cfg FullDependenciesConfig,
|
||||
for _, runner := range *runs {
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
queue := CreateQueue(t, t.Context(), cfg, runner)
|
||||
queue := CreateQueue(t, cfg, runner)
|
||||
|
||||
lock.Lock()
|
||||
deps.QueueURLs[runner] = queue
|
||||
@@ -173,10 +173,10 @@ func CreateFullDependenciesWithParams(t testing.TB, cfg FullDependenciesConfig,
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
mockServer := CreateMockServer(t, network)
|
||||
mockServer := CreateMockServer(t)
|
||||
deps.MockServer = mockServer
|
||||
|
||||
CreateDB(t, cfg, network, &CreateDatabaseConfig{
|
||||
CreateDBWithParams(t, cfg, &CreateDatabaseConfig{
|
||||
NoMigrations: true,
|
||||
})
|
||||
|
||||
|
||||
@@ -57,10 +57,12 @@ const (
|
||||
mockServerPort = 1080
|
||||
)
|
||||
|
||||
func CreateMockServer(t testing.TB, network string) *MockServer {
|
||||
func CreateMockServer(t testing.TB) *MockServer {
|
||||
port, err := nat.NewPort("tcp", strconv.Itoa(mockServerPort))
|
||||
require.NoError(t, err)
|
||||
|
||||
network := GetNetwork(t)
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "mockserver/mockserver:latest",
|
||||
Name: "mockserver_test_queryorchestration",
|
||||
|
||||
@@ -55,9 +55,8 @@ func TestWaitForMockEndpoint(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
net := GetNetwork(t)
|
||||
|
||||
server := CreateMockServer(t, net)
|
||||
server := CreateMockServer(t)
|
||||
|
||||
body := strings.NewReader(`{"team":"hello"}`)
|
||||
req, err := http.NewRequest("GET", string(server.External), body)
|
||||
|
||||
@@ -29,8 +29,7 @@ func TestCreateBucket(t *testing.T) {
|
||||
|
||||
cfg := &StoreConfig{}
|
||||
|
||||
net := GetNetwork(t)
|
||||
acfg := CreateAWSContainer(t, cfg, net)
|
||||
acfg := CreateAWSContainer(t, cfg)
|
||||
SetStoreClient(t, ctx, cfg, acfg.ExternalEndpoint)
|
||||
|
||||
CreateBucket(t, ctx, cfg)
|
||||
|
||||
+64
-11
@@ -3,6 +3,7 @@ package test
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"log/slog"
|
||||
"regexp"
|
||||
"testing"
|
||||
@@ -50,22 +51,22 @@ func GetQueueName(t testing.TB, name RunnerName) string {
|
||||
return GetAlias(t, string(name))
|
||||
}
|
||||
|
||||
func CreateQueue(t testing.TB, ctx context.Context, cfg serviceconfig.ConfigProvider, name RunnerName) string {
|
||||
func CreateQueue(t testing.TB, cfg serviceconfig.ConfigProvider, name RunnerName) string {
|
||||
t.Helper()
|
||||
queueName := GetQueueName(t, name)
|
||||
queueM, err := cfg.GetQueueClient().CreateQueue(ctx, &sqs.CreateQueueInput{
|
||||
queueM, err := cfg.GetQueueClient().CreateQueue(t.Context(), &sqs.CreateQueueInput{
|
||||
QueueName: aws.String(queueName),
|
||||
})
|
||||
require.NoError(t, err)
|
||||
slog.Info("create queue", "name", queueName, "url", *queueM.QueueUrl)
|
||||
|
||||
err = cfg.PingQueueByURL(ctx, *queueM.QueueUrl)
|
||||
err = cfg.PingQueueByURL(t.Context(), *queueM.QueueUrl)
|
||||
require.NoError(t, err)
|
||||
|
||||
return *queueM.QueueUrl
|
||||
}
|
||||
|
||||
func AssertMessage(t testing.TB, ctx context.Context, cfg serviceconfig.ConfigProvider, params *queue.ReceiveParams) types.Message {
|
||||
func AssertMessage(t testing.TB, cfg serviceconfig.ConfigProvider, params *queue.ReceiveParams) types.Message {
|
||||
t.Helper()
|
||||
timeout := time.After(30 * time.Second)
|
||||
tick := time.NewTicker(500 * time.Millisecond)
|
||||
@@ -78,7 +79,7 @@ func AssertMessage(t testing.TB, ctx context.Context, cfg serviceconfig.ConfigPr
|
||||
case <-tick.C:
|
||||
slog.Info("receiving from queue")
|
||||
|
||||
result, err := cfg.ReceiveFromQueue(ctx, params)
|
||||
result, err := cfg.ReceiveFromQueue(t.Context(), params)
|
||||
if err != nil {
|
||||
continue
|
||||
} else if len(result.Messages) < 1 {
|
||||
@@ -86,24 +87,24 @@ func AssertMessage(t testing.TB, ctx context.Context, cfg serviceconfig.ConfigPr
|
||||
}
|
||||
|
||||
return result.Messages[0]
|
||||
case <-ctx.Done():
|
||||
t.Fatal(ctx.Err())
|
||||
case <-t.Context().Done():
|
||||
t.Fatal(t.Context().Err())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func AssertMessageBody(t testing.TB, ctx context.Context, cfg serviceconfig.ConfigProvider, url string, body *regexp.Regexp) {
|
||||
func AssertMessageBody(t testing.TB, cfg serviceconfig.ConfigProvider, url string, body *regexp.Regexp) {
|
||||
t.Helper()
|
||||
message := AssertMessage(t, ctx, cfg, &queue.ReceiveParams{
|
||||
message := AssertMessage(t, cfg, &queue.ReceiveParams{
|
||||
QueueURL: url,
|
||||
})
|
||||
|
||||
assert.Regexp(t, body, *message.Body)
|
||||
}
|
||||
|
||||
func AssertMessageAttr(t testing.TB, ctx context.Context, cfg serviceconfig.ConfigProvider, url string, name string, value *regexp.Regexp) {
|
||||
func AssertMessageAttr(t testing.TB, cfg serviceconfig.ConfigProvider, url string, name string, value *regexp.Regexp) {
|
||||
t.Helper()
|
||||
message := AssertMessage(t, ctx, cfg, &queue.ReceiveParams{
|
||||
message := AssertMessage(t, cfg, &queue.ReceiveParams{
|
||||
QueueURL: url,
|
||||
Attributes: []string{name},
|
||||
})
|
||||
@@ -111,3 +112,55 @@ func AssertMessageAttr(t testing.TB, ctx context.Context, cfg serviceconfig.Conf
|
||||
assert.NotNil(t, message.MessageAttributes[name])
|
||||
assert.Regexp(t, value, *(message.MessageAttributes[name]).StringValue)
|
||||
}
|
||||
|
||||
func AssertMessageBodies(t testing.TB, cfg serviceconfig.ConfigProvider, url string, bodies []*regexp.Regexp) {
|
||||
t.Helper()
|
||||
timeout := time.After(30 * time.Second)
|
||||
tick := time.NewTicker(2 * time.Second)
|
||||
defer tick.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-timeout:
|
||||
t.Fatal("assert timeout")
|
||||
case <-tick.C:
|
||||
slog.Info("receiving from queue")
|
||||
|
||||
result, err := cfg.ReceiveFromQueue(t.Context(), &queue.ReceiveParams{
|
||||
QueueURL: url,
|
||||
VisibilityTimeout: 1,
|
||||
WaitTimeSeconds: 1,
|
||||
})
|
||||
if err != nil {
|
||||
continue
|
||||
} else if len(result.Messages) < 1 {
|
||||
continue
|
||||
}
|
||||
|
||||
found := true
|
||||
for _, m := range result.Messages {
|
||||
foundBody := false
|
||||
for _, b := range bodies {
|
||||
log.Print(*m.Body)
|
||||
if b.MatchString(*m.Body) {
|
||||
foundBody = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !foundBody {
|
||||
found = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
|
||||
return
|
||||
case <-t.Context().Done():
|
||||
t.Fatal(t.Context().Err())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+11
-18
@@ -31,11 +31,10 @@ func TestCreateQueue(t *testing.T) {
|
||||
|
||||
cfg := &TestConfig{}
|
||||
|
||||
net := GetNetwork(t)
|
||||
a := CreateAWSContainer(t, cfg, net)
|
||||
a := CreateAWSContainer(t, cfg)
|
||||
SetQueueClient(t, ctx, cfg, a.ExternalEndpoint)
|
||||
|
||||
url := CreateQueue(t, ctx, cfg, "myname")
|
||||
url := CreateQueue(t, cfg, "myname")
|
||||
assert.Equal(t, "http://localstack:4566/queue/us-east-1/000000000000/mynametestcreatequeue", url)
|
||||
}
|
||||
|
||||
@@ -48,11 +47,9 @@ func TestAssertMessageWait(t *testing.T) {
|
||||
|
||||
cfg := &TestConfig{}
|
||||
|
||||
net := GetNetwork(t)
|
||||
|
||||
a := CreateAWSContainer(t, cfg, net)
|
||||
a := CreateAWSContainer(t, cfg)
|
||||
SetQueueClient(t, ctx, cfg, a.ExternalEndpoint)
|
||||
url := CreateQueue(t, ctx, cfg, "myname")
|
||||
url := CreateQueue(t, cfg, "myname")
|
||||
|
||||
err := cfg.SendToQueue(ctx, &queue.SendParams{
|
||||
QueueURL: url,
|
||||
@@ -60,7 +57,7 @@ func TestAssertMessageWait(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
msg := AssertMessage(t, ctx, cfg, &queue.ReceiveParams{
|
||||
msg := AssertMessage(t, cfg, &queue.ReceiveParams{
|
||||
QueueURL: url,
|
||||
})
|
||||
assert.NotNil(t, msg)
|
||||
@@ -75,11 +72,9 @@ func TestAssertMessageBodyWait(t *testing.T) {
|
||||
|
||||
cfg := &TestConfig{}
|
||||
|
||||
net := GetNetwork(t)
|
||||
|
||||
a := CreateAWSContainer(t, cfg, net)
|
||||
a := CreateAWSContainer(t, cfg)
|
||||
SetQueueClient(t, ctx, cfg, a.ExternalEndpoint)
|
||||
url := CreateQueue(t, ctx, cfg, "myname")
|
||||
url := CreateQueue(t, cfg, "myname")
|
||||
|
||||
err := cfg.SendToQueue(ctx, &queue.SendParams{
|
||||
QueueURL: url,
|
||||
@@ -87,7 +82,7 @@ func TestAssertMessageBodyWait(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
AssertMessageBody(t, ctx, cfg, url, regexp.MustCompile("\"body\""))
|
||||
AssertMessageBody(t, cfg, url, regexp.MustCompile("\"body\""))
|
||||
}
|
||||
|
||||
func TestAssertMessageAttrWait(t *testing.T) {
|
||||
@@ -99,11 +94,9 @@ func TestAssertMessageAttrWait(t *testing.T) {
|
||||
|
||||
cfg := &TestConfig{}
|
||||
|
||||
net := GetNetwork(t)
|
||||
|
||||
a := CreateAWSContainer(t, cfg, net)
|
||||
a := CreateAWSContainer(t, cfg)
|
||||
SetQueueClient(t, ctx, cfg, a.ExternalEndpoint)
|
||||
url := CreateQueue(t, ctx, cfg, "myname")
|
||||
url := CreateQueue(t, cfg, "myname")
|
||||
|
||||
name := "name"
|
||||
value := "value"
|
||||
@@ -120,7 +113,7 @@ func TestAssertMessageAttrWait(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
AssertMessageAttr(t, ctx, cfg, url, name, regexp.MustCompile(value))
|
||||
AssertMessageAttr(t, cfg, url, name, regexp.MustCompile(value))
|
||||
}
|
||||
|
||||
func TestGetQueueURL(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user