Merged in feature/functestcov (pull request #84)

Function Test Coverage

* test

* scripts
This commit is contained in:
Michael McGuinness
2025-03-04 15:51:03 +00:00
parent 4b8c930ff1
commit d91ef1832b
85 changed files with 446 additions and 489 deletions
+4 -6
View File
@@ -11,6 +11,8 @@ import (
"strings"
"testing"
"github.com/stretchr/testify/require"
"github.com/aws/aws-sdk-go-v2/service/s3"
"github.com/google/uuid"
"github.com/pashagolub/pgxmock/v3"
@@ -21,9 +23,7 @@ import (
func TestClean(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocCleanConfig{}
cfg.DBPool = pool
@@ -166,9 +166,7 @@ func TestExecuteCleanTasks(t *testing.T) {
func TestStoreClean(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocCleanConfig{}
cfg.DBPool = pool
+2 -3
View File
@@ -22,6 +22,7 @@ import (
"github.com/pashagolub/pgxmock/v3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
)
type DocCleanConfig struct {
@@ -33,9 +34,7 @@ type DocCleanConfig struct {
func TestCreate(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
mockSQS := queuemock.NewMockSQSClient(t)
+3 -3
View File
@@ -8,6 +8,8 @@ import (
"queryorchestration/internal/serviceconfig"
"testing"
"github.com/stretchr/testify/require"
"github.com/google/uuid"
"github.com/pashagolub/pgxmock/v3"
"github.com/stretchr/testify/assert"
@@ -17,9 +19,7 @@ func TestGet(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &serviceconfig.BaseConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
+8 -18
View File
@@ -11,6 +11,8 @@ import (
queuemock "queryorchestration/mocks/queue"
"testing"
"github.com/stretchr/testify/require"
"github.com/aws/aws-sdk-go-v2/service/sqs"
"github.com/google/uuid"
"github.com/pashagolub/pgxmock/v3"
@@ -22,9 +24,7 @@ func TestCreate(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocInitConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
@@ -97,9 +97,7 @@ func TestGetCreateParams(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocInitConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
@@ -136,9 +134,7 @@ func TestGetCreateParamsExisting(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocInitConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
@@ -179,9 +175,7 @@ func TestGetCreateParamsCurrentDocErr(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocInitConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
@@ -211,9 +205,7 @@ func TestSubmitCreate(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocInitConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
@@ -253,9 +245,7 @@ func TestSubmitCreateExists(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocInitConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
+2 -3
View File
@@ -11,15 +11,14 @@ import (
"github.com/google/uuid"
"github.com/pashagolub/pgxmock/v3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestListByJobId(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &serviceconfig.BaseConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
+3 -3
View File
@@ -12,6 +12,8 @@ import (
queuemock "queryorchestration/mocks/queue"
"testing"
"github.com/stretchr/testify/require"
"github.com/aws/aws-sdk-go-v2/service/sqs"
"github.com/google/uuid"
"github.com/pashagolub/pgxmock/v3"
@@ -23,9 +25,7 @@ func TestSync(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocSyncConfig{}
cfg.DBPool = pool
cfg.DBQueries = repository.New(pool)
+3 -3
View File
@@ -12,6 +12,8 @@ import (
queuemock "queryorchestration/mocks/queue"
"testing"
"github.com/stretchr/testify/require"
"github.com/aws/aws-sdk-go-v2/service/sqs"
"github.com/google/uuid"
"github.com/pashagolub/pgxmock/v3"
@@ -27,9 +29,7 @@ type DocTextConfig struct {
func TestCreate(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
mockSQS := queuemock.NewMockSQSClient(t)
+3 -3
View File
@@ -8,6 +8,8 @@ import (
textversion "queryorchestration/internal/document/text/version"
"testing"
"github.com/stretchr/testify/require"
"github.com/google/uuid"
"github.com/pashagolub/pgxmock/v3"
"github.com/stretchr/testify/assert"
@@ -16,9 +18,7 @@ import (
func TestExtract(t *testing.T) {
ctx := context.Background()
pool, err := pgxmock.NewPool()
if err != nil {
t.Fatalf("failed to open pgxmock database: %v", err)
}
require.NoError(t, err)
cfg := &DocTextConfig{}
cfg.DBPool = pool