Merged in feature/shorttestsanddirtidy (pull request #26)

Add short tests and Tidy internal directories

* complete the tasks
This commit is contained in:
Michael McGuinness
2025-01-17 12:00:32 +00:00
parent b453f6cb23
commit fa95d733ca
84 changed files with 171 additions and 101 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"fmt"
"log"
"net/url"
"queryorchestration/internal/env"
"queryorchestration/internal/server/env"
"github.com/docker/go-connections/nat"
"github.com/jackc/pgx/v5"
+3
View File
@@ -12,6 +12,9 @@ import (
)
func TestDBConn(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
Migrations: &database.MigrationConfig{
+3
View File
@@ -12,6 +12,9 @@ import (
)
func TestRunMigrations(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{})
@@ -2,9 +2,9 @@ package collector_test
import (
"context"
"queryorchestration/internal/collector"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/job/collector"
"testing"
"github.com/google/uuid"
+3 -3
View File
@@ -3,11 +3,11 @@ package query
import (
"context"
"fmt"
contextfull "queryorchestration/internal/contextFull"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
jsonextractor "queryorchestration/internal/jsonExtractor"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
contextfull "queryorchestration/internal/query/types/contextFull"
jsonextractor "queryorchestration/internal/query/types/jsonExtractor"
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/query"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
@@ -2,11 +2,11 @@ package document
import (
"context"
"queryorchestration/internal/collector"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryqueue "queryorchestration/internal/queryQueue"
"queryorchestration/internal/result"
"queryorchestration/internal/job/collector"
queryqueue "queryorchestration/internal/query/queue"
"queryorchestration/internal/query/result"
"github.com/google/uuid"
)
@@ -5,7 +5,7 @@ import (
"errors"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/document"
"queryorchestration/internal/query/document"
"testing"
"github.com/google/uuid"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"github.com/google/uuid"
)
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/query"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/query"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/query"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
@@ -2,7 +2,7 @@ package queryprocessor_test
import (
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
@@ -2,7 +2,7 @@ package queryprocessor
import (
"context"
"queryorchestration/internal/result"
"queryorchestration/internal/query/result"
"github.com/google/uuid"
)
@@ -3,7 +3,7 @@ package queryqueue
import (
"context"
"queryorchestration/internal/database"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
)
func (q *Queue) getUnsyncedQueries() {
@@ -2,11 +2,11 @@ package queryqueue
import (
"context"
"queryorchestration/internal/collector"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
"queryorchestration/internal/job/collector"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
"testing"
"github.com/google/uuid"
@@ -3,8 +3,8 @@ package queryqueue
import (
"context"
"queryorchestration/internal/database"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
"github.com/jackc/pgx/v5/pgtype"
)
@@ -3,12 +3,12 @@ package queryqueue_test
import (
"context"
"fmt"
"queryorchestration/internal/collector"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryqueue "queryorchestration/internal/queryQueue"
"queryorchestration/internal/result"
"queryorchestration/internal/job/collector"
queryprocessor "queryorchestration/internal/query/processor"
queryqueue "queryorchestration/internal/query/queue"
"queryorchestration/internal/query/result"
"testing"
"github.com/google/uuid"
@@ -4,7 +4,7 @@ import (
"context"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
@@ -3,12 +3,12 @@ package queryqueue
import (
"context"
"fmt"
contextfull "queryorchestration/internal/contextFull"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
jsonextractor "queryorchestration/internal/jsonExtractor"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
contextfull "queryorchestration/internal/query/types/contextFull"
jsonextractor "queryorchestration/internal/query/types/jsonExtractor"
)
func (q *Queue) setResult(ctx context.Context, qu *queryprocessor.Query, resultValues []result.Value) error {
@@ -4,8 +4,8 @@ import (
"context"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
"testing"
"github.com/google/uuid"
@@ -2,10 +2,10 @@ package queryqueue
import (
"context"
"queryorchestration/internal/collector"
"queryorchestration/internal/database"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
"queryorchestration/internal/job/collector"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
"github.com/google/uuid"
)
@@ -3,12 +3,12 @@ package queryqueue_test
import (
"context"
"errors"
"queryorchestration/internal/collector"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryqueue "queryorchestration/internal/queryQueue"
"queryorchestration/internal/result"
"queryorchestration/internal/job/collector"
queryprocessor "queryorchestration/internal/query/processor"
queryqueue "queryorchestration/internal/query/queue"
"queryorchestration/internal/query/result"
"testing"
"github.com/google/uuid"
@@ -2,7 +2,7 @@ package result_test
import (
"queryorchestration/internal/database/repository"
"queryorchestration/internal/result"
"queryorchestration/internal/query/result"
"testing"
"github.com/google/uuid"
@@ -5,7 +5,7 @@ import (
"errors"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/result"
"queryorchestration/internal/query/result"
"testing"
"github.com/google/uuid"
@@ -3,7 +3,7 @@ package contextfull
import (
"context"
"queryorchestration/internal/database"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
)
type Creator struct {
@@ -2,10 +2,10 @@ package contextfull_test
import (
"context"
contextfull "queryorchestration/internal/contextFull"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
contextfull "queryorchestration/internal/query/types/contextFull"
"testing"
"github.com/google/uuid"
@@ -2,9 +2,9 @@ package contextfull_test
import (
"context"
contextfull "queryorchestration/internal/contextFull"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
contextfull "queryorchestration/internal/query/types/contextFull"
"testing"
"github.com/google/uuid"
@@ -3,8 +3,8 @@ package contextfull
import (
"context"
"errors"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
)
type Extractor struct {
@@ -3,7 +3,7 @@ package contextfull
import (
"context"
"queryorchestration/internal/database"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
)
type Updator struct {
@@ -2,10 +2,10 @@ package contextfull_test
import (
"context"
contextfull "queryorchestration/internal/contextFull"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
contextfull "queryorchestration/internal/query/types/contextFull"
"testing"
"github.com/google/uuid"
@@ -3,7 +3,7 @@ package jsonextractor
import (
"context"
"queryorchestration/internal/database"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
)
type Creator struct {
@@ -4,8 +4,8 @@ import (
"context"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
jsonextractor "queryorchestration/internal/jsonExtractor"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
jsonextractor "queryorchestration/internal/query/types/jsonExtractor"
"testing"
"github.com/google/uuid"
@@ -3,12 +3,12 @@ package jsonextractor_test
import (
"context"
"fmt"
contextfull "queryorchestration/internal/contextFull"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
jsonextractor "queryorchestration/internal/jsonExtractor"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
contextfull "queryorchestration/internal/query/types/contextFull"
jsonextractor "queryorchestration/internal/query/types/jsonExtractor"
"testing"
"github.com/google/uuid"
@@ -6,8 +6,8 @@ import (
"fmt"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
"queryorchestration/internal/result"
queryprocessor "queryorchestration/internal/query/processor"
"queryorchestration/internal/query/result"
"github.com/tidwall/gjson"
)
@@ -3,7 +3,7 @@ package jsonextractor
import (
"context"
"queryorchestration/internal/database"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
)
type Updator struct {
@@ -4,8 +4,8 @@ import (
"context"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
jsonextractor "queryorchestration/internal/jsonExtractor"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
jsonextractor "queryorchestration/internal/query/types/jsonExtractor"
"testing"
"github.com/google/uuid"
+3 -3
View File
@@ -3,9 +3,9 @@ package query
import (
"context"
"fmt"
contextfull "queryorchestration/internal/contextFull"
jsonextractor "queryorchestration/internal/jsonExtractor"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
contextfull "queryorchestration/internal/query/types/contextFull"
jsonextractor "queryorchestration/internal/query/types/jsonExtractor"
)
func (s *Service) Update(ctx context.Context, entity *queryprocessor.Update) error {
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/query"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
+1 -1
View File
@@ -4,7 +4,7 @@ import (
"context"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
queryprocessor "queryorchestration/internal/queryProcessor"
queryprocessor "queryorchestration/internal/query/processor"
"testing"
"github.com/google/uuid"
@@ -14,6 +14,9 @@ import (
)
func TestNew(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
@@ -1,7 +1,7 @@
package env_test
import (
"queryorchestration/internal/env"
"queryorchestration/internal/server/env"
"testing"
"github.com/stretchr/testify/assert"
@@ -1,7 +1,7 @@
package env_test
import (
"queryorchestration/internal/env"
"queryorchestration/internal/server/env"
"testing"
"github.com/stretchr/testify/assert"
@@ -2,7 +2,7 @@ package otel_test
import (
"context"
"queryorchestration/internal/otel"
"queryorchestration/internal/server/otel"
"testing"
"github.com/stretchr/testify/assert"
@@ -2,7 +2,7 @@ package queue_test
import (
"context"
"queryorchestration/internal/queue"
"queryorchestration/internal/server/queue"
"queryorchestration/internal/test"
"testing"
@@ -11,6 +11,9 @@ import (
)
func TestDelete(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
queueConfig, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
defer cleanup()
@@ -3,8 +3,8 @@ package queue
import (
"context"
"log"
"queryorchestration/internal/env"
"queryorchestration/internal/server"
"queryorchestration/internal/server/env"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/sqs"
@@ -4,8 +4,8 @@ import (
"context"
"os"
"path"
"queryorchestration/internal/queue"
"queryorchestration/internal/server"
"queryorchestration/internal/server/queue"
"queryorchestration/internal/test"
"testing"
"time"
@@ -14,6 +14,9 @@ import (
)
func TestNew(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
_, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
defer cleanup()
@@ -2,7 +2,7 @@ package queue_test
import (
"context"
"queryorchestration/internal/queue"
"queryorchestration/internal/server/queue"
"queryorchestration/internal/test"
"testing"
"time"
@@ -18,6 +18,9 @@ func (s MockController) Process(ctx context.Context, config *queue.Config, msg *
}
func TestPollMessages(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
queueConfig, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
defer cleanup()
@@ -38,6 +41,9 @@ func TestPollMessages(t *testing.T) {
}
func TestPollMessage(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
queueConfig, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
defer cleanup()
@@ -2,7 +2,7 @@ package queue_test
import (
"context"
"queryorchestration/internal/queue"
"queryorchestration/internal/server/queue"
"queryorchestration/internal/test"
"testing"
@@ -11,6 +11,9 @@ import (
)
func TestReceive(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
queueConfig, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
defer cleanup()
@@ -2,7 +2,7 @@ package queue_test
import (
"context"
"queryorchestration/internal/queue"
"queryorchestration/internal/server/queue"
"queryorchestration/internal/test"
"testing"
@@ -11,6 +11,9 @@ import (
)
func TestSend(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
queueConfig, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
defer cleanup()
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"log"
"queryorchestration/internal/database"
"queryorchestration/internal/database/repository"
"queryorchestration/internal/otel"
"queryorchestration/internal/server/otel"
"github.com/go-playground/validator/v10"
)
+3
View File
@@ -12,6 +12,9 @@ import (
)
func TestNew(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
_, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{})
+6
View File
@@ -12,6 +12,9 @@ import (
)
func TestCreateAPIContainer(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
ncfg, ncleanup := test.CreateNetwork(t, ctx)
@@ -37,6 +40,9 @@ func TestCreateAPIContainer(t *testing.T) {
cleanup()
}
func TestCreateAPIWithDependencies(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
conn, cleanup := test.CreateAPIWithDependencies(t, ctx, "queryService")
+3
View File
@@ -11,6 +11,9 @@ import (
)
func TestCreateContainer(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
ncfg, ncleanup := CreateNetwork(t, ctx)
+6
View File
@@ -12,6 +12,9 @@ import (
)
func TestCreateDB(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
dbcfg, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{})
@@ -23,6 +26,9 @@ func TestCreateDB(t *testing.T) {
}
func TestCreateDBWithMigrations(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
dbcfg, cleanup := test.CreateDB(t, ctx, &test.CreateDatabaseConfig{
+1 -1
View File
@@ -3,7 +3,7 @@ package test
import (
"context"
"fmt"
"queryorchestration/internal/queue"
"queryorchestration/internal/server/queue"
"testing"
"time"
+13 -1
View File
@@ -2,7 +2,7 @@ package test_test
import (
"context"
"queryorchestration/internal/queue"
"queryorchestration/internal/server/queue"
"queryorchestration/internal/test"
"testing"
@@ -12,6 +12,9 @@ import (
)
func TestCreateQueue(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
qcfg, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
@@ -22,6 +25,9 @@ func TestCreateQueue(t *testing.T) {
}
func TestAssertMessageWait(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
qcfg, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
@@ -40,6 +46,9 @@ func TestAssertMessageWait(t *testing.T) {
}
func TestAssertMessageBodyWait(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
qcfg, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
@@ -57,6 +66,9 @@ func TestAssertMessageBodyWait(t *testing.T) {
}
func TestAssertMessageAttrWait(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
qcfg, cleanup := test.CreateQueue(t, ctx, &test.CreateQueueConfig{})
+6
View File
@@ -11,6 +11,9 @@ import (
)
func TestCreateQueueContainer(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
ncfg, ncleanup := CreateNetwork(t, ctx)
@@ -47,6 +50,9 @@ func TestCreateQueueContainer(t *testing.T) {
}
func TestCreateQueueWithDependencies(t *testing.T) {
if testing.Short() {
t.Skip("Skipping long test in short mode")
}
ctx := context.Background()
conn, cleanup := CreateQueueWithDependencies(t, ctx, "queryRunner")