Merged in feature/ecr (pull request #161)
Feature/ecr * nosave * repo * awscli * unzip * ignore * moreram * 14k * ref * deployment * 12k * uselocal * go * dockercomd * reorder * iamgename * installs * tart * cli * clideps * y * dockerce * nodock * multi * rmecr * dev
This commit is contained in:
@@ -16,6 +16,7 @@ linters:
|
||||
- godox
|
||||
- cyclop
|
||||
- unused
|
||||
- usetesting
|
||||
|
||||
linters-settings:
|
||||
errcheck:
|
||||
|
||||
+51
-5
@@ -9,7 +9,7 @@ definitions:
|
||||
|
||||
services:
|
||||
docker:
|
||||
memory: 16384
|
||||
memory: 12000
|
||||
|
||||
steps:
|
||||
- step: &fullsuite
|
||||
@@ -36,14 +36,60 @@ definitions:
|
||||
|
||||
- devbox install
|
||||
- devbox run -- AWS_PROFILE="" task fullsuite
|
||||
- docker save query-orchestration:latest -o dockerimage.tar
|
||||
artifacts:
|
||||
- dockerimage.tar
|
||||
- step: &fullsuite-and-publish
|
||||
name: Fullsuite and Publish
|
||||
size: 16x
|
||||
oidc: true
|
||||
deployment: dev
|
||||
services:
|
||||
- docker
|
||||
caches:
|
||||
- devbox
|
||||
- apt-lists
|
||||
- apt-cache
|
||||
script:
|
||||
- export DOCKER_BUILDKIT=0
|
||||
- export DOCKER_HOST=tcp://localhost:2375
|
||||
- export TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=tcp://localhost:2375
|
||||
- export TESTCONTAINERS_RYUK_DISABLED=true
|
||||
- export AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION:-us-east-1}
|
||||
- export IMAGE_TAG=$ECR_REGISTRY/doczy/query-orchestration:$BITBUCKET_COMMIT
|
||||
- export AWS_WEB_IDENTITY_TOKEN_FILE=$(pwd)/web-identity-token
|
||||
- echo $BITBUCKET_STEP_OIDC_TOKEN > $(pwd)/web-identity-token
|
||||
|
||||
- rm /etc/apt/apt.conf.d/docker-clean || true
|
||||
- apt-get update
|
||||
- apt-get install -y curl git unzip
|
||||
|
||||
- mkdir -p out
|
||||
- cd out
|
||||
|
||||
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
|
||||
- unzip awscliv2.zip
|
||||
- ./aws/install
|
||||
|
||||
- curl -fsSL https://get.jetify.com/devbox | bash -s -- -f
|
||||
- export PATH="/root/.local/bin:$PATH"
|
||||
- cd ..
|
||||
|
||||
- aws sts get-caller-identity --query "Arn" --output text
|
||||
- |
|
||||
aws ecr get-login-password --region $AWS_DEFAULT_REGION | \
|
||||
docker login --username AWS --password-stdin $ECR_REGISTRY
|
||||
|
||||
- touch .env
|
||||
- devbox install
|
||||
- devbox run -- AWS_PROFILE="" task fullsuite
|
||||
|
||||
- docker tag queryorchestration:latest $IMAGE_TAG
|
||||
- docker push $IMAGE_TAG
|
||||
after-script:
|
||||
- docker stop registry || true
|
||||
|
||||
pipelines:
|
||||
branches:
|
||||
main:
|
||||
- step: *fullsuite
|
||||
- step: *fullsuite-and-publish
|
||||
|
||||
pull-requests:
|
||||
"**":
|
||||
|
||||
@@ -46,7 +46,7 @@ func (s *Service) normalizeCreate(params *CreateParams) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Make sure the char ~ never makes way in as a valid client id character
|
||||
// NOTE: Make sure the char ~ never makes way in as a valid client id character
|
||||
// Reference bucket key filename
|
||||
const CLIENT_ID_REGEX = `[a-zA-Z0-9\_#-]+`
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -13,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
@@ -14,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
+17
-17
@@ -14,28 +14,28 @@ type Client struct {
|
||||
CanSync bool
|
||||
}
|
||||
|
||||
func (c *Client) NormalizeCanSyncUpdate(n **bool) {
|
||||
if n == nil || *n == nil {
|
||||
func (c *Client) NormalizeCanSyncUpdate(canSync **bool) {
|
||||
if canSync == nil || *canSync == nil {
|
||||
return
|
||||
}
|
||||
|
||||
if c.CanSync == **n {
|
||||
*n = nil
|
||||
if c.CanSync == **canSync {
|
||||
*canSync = nil
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) NormalizeNameUpdate(n **string) error {
|
||||
if n == nil || *n == nil {
|
||||
func (c *Client) NormalizeNameUpdate(name **string) error {
|
||||
if name == nil || *name == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := normalizeName(*n)
|
||||
err := normalizeName(*name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if c.Name == **n {
|
||||
*n = nil
|
||||
if c.Name == **name {
|
||||
*name = nil
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -46,18 +46,18 @@ func normalizeName(name *string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
uname := strings.TrimSpace(*name)
|
||||
spacere := regexp.MustCompile(`\s+`)
|
||||
uname = spacere.ReplaceAllString(uname, " ")
|
||||
normalizedName := strings.TrimSpace(*name)
|
||||
spaceRegex := regexp.MustCompile(`\s+`)
|
||||
normalizedName = spaceRegex.ReplaceAllString(normalizedName, " ")
|
||||
|
||||
reg := `^[a-zA-Z0-9\_\- \(\)\.\,]+$`
|
||||
validNameRegex := `^[a-zA-Z0-9\_\- \(\)\.\,]+$`
|
||||
|
||||
alphanumeric := regexp.MustCompile(reg)
|
||||
if !alphanumeric.MatchString(uname) {
|
||||
return fmt.Errorf(`"%s" must have regex: %s`, uname, reg)
|
||||
alphanumeric := regexp.MustCompile(validNameRegex)
|
||||
if !alphanumeric.MatchString(normalizedName) {
|
||||
return fmt.Errorf(`"%s" must have regex: %s`, normalizedName, validNameRegex)
|
||||
}
|
||||
|
||||
*name = uname
|
||||
*name = normalizedName
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -34,51 +34,51 @@ func TestNormalizeName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNormalizeCanSyncUpdate(t *testing.T) {
|
||||
c := Client{
|
||||
testClient := Client{
|
||||
ID: "EXAMPLE",
|
||||
CanSync: true,
|
||||
}
|
||||
|
||||
c.NormalizeCanSyncUpdate(nil)
|
||||
var val *bool
|
||||
c.NormalizeCanSyncUpdate(&val)
|
||||
assert.Nil(t, val)
|
||||
testClient.NormalizeCanSyncUpdate(nil)
|
||||
var updateCanSync *bool
|
||||
testClient.NormalizeCanSyncUpdate(&updateCanSync)
|
||||
assert.Nil(t, updateCanSync)
|
||||
|
||||
v := true
|
||||
val = &v
|
||||
c.NormalizeCanSyncUpdate(&val)
|
||||
assert.Nil(t, val)
|
||||
canSync := true
|
||||
updateCanSync = &canSync
|
||||
testClient.NormalizeCanSyncUpdate(&updateCanSync)
|
||||
assert.Nil(t, updateCanSync)
|
||||
|
||||
v = false
|
||||
val = &v
|
||||
c.NormalizeCanSyncUpdate(&val)
|
||||
assert.NotNil(t, *val)
|
||||
canSync = false
|
||||
updateCanSync = &canSync
|
||||
testClient.NormalizeCanSyncUpdate(&updateCanSync)
|
||||
assert.NotNil(t, *updateCanSync)
|
||||
}
|
||||
|
||||
func TestNormalizeNameUpdate(t *testing.T) {
|
||||
c := Client{
|
||||
testClient := Client{
|
||||
ID: "EXAMPLE",
|
||||
Name: "example_name",
|
||||
}
|
||||
|
||||
err := c.NormalizeNameUpdate(nil)
|
||||
err := testClient.NormalizeNameUpdate(nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
v := "update_name"
|
||||
val := &v
|
||||
err = c.NormalizeNameUpdate(&val)
|
||||
name := "update_name"
|
||||
updateName := &name
|
||||
err = testClient.NormalizeNameUpdate(&updateName)
|
||||
require.NoError(t, err)
|
||||
assert.NotNil(t, val)
|
||||
assert.Equal(t, "update_name", *val)
|
||||
assert.NotNil(t, updateName)
|
||||
assert.Equal(t, "update_name", *updateName)
|
||||
|
||||
v = c.Name
|
||||
val = &v
|
||||
err = c.NormalizeNameUpdate(&val)
|
||||
name = testClient.Name
|
||||
updateName = &name
|
||||
err = testClient.NormalizeNameUpdate(&updateName)
|
||||
require.NoError(t, err)
|
||||
assert.Nil(t, val)
|
||||
assert.Nil(t, updateName)
|
||||
|
||||
v = "###"
|
||||
val = &v
|
||||
err = c.NormalizeNameUpdate(&val)
|
||||
name = "###"
|
||||
updateName = &name
|
||||
err = testClient.NormalizeNameUpdate(&updateName)
|
||||
assert.Error(t, err)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package client_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
@@ -15,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetStatus(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package clientsync
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -25,7 +24,7 @@ type ClientSyncConfig struct {
|
||||
|
||||
func TestTrigger(t *testing.T) {
|
||||
t.Run("two batches", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -86,7 +85,7 @@ func TestTrigger(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
t.Run("empty batch", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package clientupdate
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -25,7 +24,7 @@ type Config struct {
|
||||
}
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -119,7 +118,7 @@ func TestNormalizeUpdateParams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitUpdate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -167,7 +166,7 @@ func TestSubmitUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInformUpdate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &Config{}
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
|
||||
@@ -156,7 +156,7 @@ func TestCognitoAuthFlow(t *testing.T) {
|
||||
|
||||
// Ensure server shuts down at the end of the test
|
||||
defer func() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), 5*time.Second)
|
||||
defer cancel()
|
||||
if err := server.Shutdown(ctx); err != nil {
|
||||
t.Logf("Server shutdown error: %v", err)
|
||||
@@ -191,7 +191,7 @@ func TestCognitoAuthFlow(t *testing.T) {
|
||||
chromedp.Flag("disable-cache", true),
|
||||
)
|
||||
|
||||
allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
|
||||
allocCtx, cancel := chromedp.NewExecAllocator(t.Context(), opts...)
|
||||
defer cancel()
|
||||
|
||||
// Create Chrome context with longer timeout for authentication flow
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package collector_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -17,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetByClientID(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -50,7 +49,7 @@ func TestGetByClientID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListQueries(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package collectorset_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -25,7 +24,7 @@ type CollectorSetConfig struct {
|
||||
}
|
||||
|
||||
func TestSet(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package collectorset
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -27,7 +26,7 @@ type CollectorSetConfig struct {
|
||||
|
||||
func TestGetSetParams(t *testing.T) {
|
||||
t.Run("all params", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -84,7 +83,7 @@ func TestGetSetParams(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("no params", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -104,7 +103,7 @@ func TestGetSetParams(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("ONLY active version to next latest", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -130,7 +129,7 @@ func TestGetSetParams(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("no fields change", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -161,7 +160,7 @@ func TestGetSetParams(t *testing.T) {
|
||||
func TestSubmitSet(t *testing.T) {
|
||||
t.Run("all fields", func(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -229,7 +228,7 @@ func TestSubmitSet(t *testing.T) {
|
||||
})
|
||||
t.Run("only active version", func(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -517,7 +516,7 @@ func TestGetAddFields(t *testing.T) {
|
||||
func TestNormalizeSetFieldsToDB(t *testing.T) {
|
||||
t.Run("valid key", func(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -550,7 +549,7 @@ func TestNormalizeSetFieldsToDB(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("duplicate values", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -578,7 +577,7 @@ func TestNormalizeSetFieldsToDB(t *testing.T) {
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("no changes", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &CollectorSetConfig{}
|
||||
|
||||
svc := Service{
|
||||
@@ -603,7 +602,7 @@ func TestNormalizeSetFieldsToDB(t *testing.T) {
|
||||
|
||||
func TestInformSet(t *testing.T) {
|
||||
t.Run("with version update", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -636,7 +635,7 @@ func TestInformSet(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
t.Run("with no update", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -659,7 +658,7 @@ func TestInformSet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNormalizeFieldsToDB(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/serviceconfig/database"
|
||||
@@ -10,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateDB(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &database.DBConfig{
|
||||
DBHost: "invalid_value",
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -17,7 +16,7 @@ func TestClean(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -17,7 +16,7 @@ func TestClientQueries(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -19,7 +18,7 @@ func TestCollector(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -221,7 +220,7 @@ func TestCollector(t *testing.T) {
|
||||
}
|
||||
|
||||
func BenchmarkListCollectorQueries(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
ctx := b.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(b, cfg)
|
||||
@@ -243,7 +242,7 @@ func BenchmarkListCollectorQueries(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkGetCollectorByClientID(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
ctx := b.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -21,7 +20,7 @@ func TestQueriesNew(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestQueriesWithTx(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -18,7 +17,7 @@ func TestDocument(t *testing.T) {
|
||||
}
|
||||
t.Run("List docs for a client", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -38,7 +37,7 @@ func TestDocument(t *testing.T) {
|
||||
})
|
||||
t.Run("Create document", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -68,7 +67,7 @@ func TestDocument(t *testing.T) {
|
||||
|
||||
t.Run("Create two documents", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -103,7 +102,7 @@ func TestDocument(t *testing.T) {
|
||||
})
|
||||
t.Run("Two clients", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -149,7 +148,7 @@ func TestDocument(t *testing.T) {
|
||||
})
|
||||
t.Run("document summary", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -181,7 +180,7 @@ func TestDocument(t *testing.T) {
|
||||
})
|
||||
t.Run("document external", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -214,7 +213,7 @@ func TestDocument(t *testing.T) {
|
||||
})
|
||||
t.Run("doc id by hash", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -245,7 +244,7 @@ func TestDocument(t *testing.T) {
|
||||
})
|
||||
t.Run("doc entry", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -286,7 +285,7 @@ func TestDocument(t *testing.T) {
|
||||
})
|
||||
t.Run("doc latest entry", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -18,7 +17,7 @@ func TestQueries(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -227,7 +226,7 @@ func TestQueryDependencyTree(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -445,7 +444,7 @@ func TestQueriesList(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -500,7 +499,7 @@ func TestListQueryClients(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -588,7 +587,7 @@ func TestListQueryClients(t *testing.T) {
|
||||
}
|
||||
|
||||
func BenchmarkListQueryDirectDependentsByDocId(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
ctx := b.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -20,7 +19,7 @@ func TestResults(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -47,7 +46,7 @@ func TestResultValues(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -376,7 +375,7 @@ func TestUnsyncedNoDepsQueries(t *testing.T) {
|
||||
|
||||
t.Run("two files", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -472,7 +471,7 @@ func TestUnsyncedNoDepsQueries(t *testing.T) {
|
||||
|
||||
t.Run("update query", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -499,7 +498,7 @@ func TestUnsyncedNoDepsQueries(t *testing.T) {
|
||||
}
|
||||
|
||||
func BenchmarkListUnsynced(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
ctx := b.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestListClientDocumentIDs(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -197,7 +197,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("no collector", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -218,7 +218,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("no documents", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -247,7 +247,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("create document", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -282,7 +282,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("document fail clean", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -318,7 +318,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("clean document", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -360,7 +360,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("extracted text", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -400,7 +400,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("single query", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -430,7 +430,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("change super query", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -460,7 +460,7 @@ func TestClientSync(t *testing.T) {
|
||||
})
|
||||
t.Run("upstream query update result", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -504,7 +504,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("update upstream query", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -564,7 +564,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("update text entry", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -602,7 +602,7 @@ func TestClientSync(t *testing.T) {
|
||||
})
|
||||
t.Run("update text entry result", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -648,7 +648,7 @@ func TestClientSync(t *testing.T) {
|
||||
})
|
||||
t.Run("update clean entry", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -689,7 +689,7 @@ func TestClientSync(t *testing.T) {
|
||||
})
|
||||
t.Run("update clean entry with result", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -756,7 +756,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("add new collector version", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -781,7 +781,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("add new active collector version", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -812,7 +812,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("remove query from new collector version", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -843,7 +843,7 @@ func TestClientSync(t *testing.T) {
|
||||
})
|
||||
t.Run("remove query and update collector version", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -881,7 +881,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("add existing query", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -911,7 +911,7 @@ func TestClientSync(t *testing.T) {
|
||||
|
||||
t.Run("add super query", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -940,7 +940,7 @@ func TestClientSync(t *testing.T) {
|
||||
})
|
||||
t.Run("add super query with result", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -1102,7 +1102,7 @@ func createDocumentWithCollectorAndResults(t testing.TB, queries *repository.Que
|
||||
}
|
||||
|
||||
func BenchmarkIsClientSynced(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
ctx := b.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(b, cfg)
|
||||
@@ -1121,7 +1121,7 @@ func BenchmarkIsClientSynced(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkGetDocumentExternal(b *testing.B) {
|
||||
ctx := context.Background()
|
||||
ctx := b.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(b, cfg)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package repository_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -20,7 +19,7 @@ func TestTextExtraction(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -127,7 +126,7 @@ func TestTextTextractPart(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
@@ -256,7 +255,7 @@ func TestTextOutPart(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documentclean
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -23,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestClean(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -113,7 +112,7 @@ func TestClean(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCleanTasks(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
@@ -172,7 +171,7 @@ func TestExecuteCleanTasks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStoreClean(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documentclean
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -21,7 +20,7 @@ import (
|
||||
|
||||
func TestGetBodyMimeType(t *testing.T) {
|
||||
t.Run("invalid type", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -59,7 +58,7 @@ func TestGetBodyMimeType(t *testing.T) {
|
||||
assert.Equal(t, documenttypes.MimeTypeInvalid, contentType)
|
||||
})
|
||||
t.Run("pdf", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -108,7 +107,7 @@ func TestGetBodyMimeType(t *testing.T) {
|
||||
assert.Equal(t, documenttypes.MimeTypePDF, contentType)
|
||||
})
|
||||
t.Run("pdf start", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -157,7 +156,7 @@ func TestGetBodyMimeType(t *testing.T) {
|
||||
assert.Equal(t, documenttypes.MimeTypeInvalid, contentType)
|
||||
})
|
||||
t.Run("pdf end", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -206,7 +205,7 @@ func TestGetBodyMimeType(t *testing.T) {
|
||||
assert.Equal(t, documenttypes.MimeTypeInvalid, contentType)
|
||||
})
|
||||
t.Run("short", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -269,7 +268,7 @@ func TestGetMetadataMimeType(t *testing.T) {
|
||||
|
||||
func TestGetAcceptedMimeType(t *testing.T) {
|
||||
t.Run("invalid type", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -307,7 +306,7 @@ func TestGetAcceptedMimeType(t *testing.T) {
|
||||
assert.Equal(t, documenttypes.MimeTypeInvalid, contentType)
|
||||
})
|
||||
t.Run("pdf mimetype", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -320,7 +319,7 @@ func TestGetAcceptedMimeType(t *testing.T) {
|
||||
assert.Equal(t, documenttypes.MimeTypePDF, contentType)
|
||||
})
|
||||
t.Run("pdf format", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -372,7 +371,7 @@ func TestGetAcceptedMimeType(t *testing.T) {
|
||||
|
||||
func TestGetBytesBuffer(t *testing.T) {
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -412,7 +411,7 @@ func TestGetBytesBuffer(t *testing.T) {
|
||||
assert.NotNil(t, buffer)
|
||||
})
|
||||
t.Run("negative start", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
@@ -452,7 +451,7 @@ func TestGetBytesBuffer(t *testing.T) {
|
||||
assert.NotNil(t, buffer)
|
||||
})
|
||||
t.Run("zero length", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := &DocCleanConfig{}
|
||||
mockS3 := objectstoremock.NewMockS3Client(t)
|
||||
cfg.StoreClient = mockS3
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documentclean
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -33,7 +32,7 @@ type DocCleanConfig struct {
|
||||
}
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -139,7 +138,7 @@ func TestCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInformClean(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
|
||||
cfg := &DocCleanConfig{}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package document_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetSummary(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -44,7 +43,7 @@ func TestGetSummary(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetExternal(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documentinit
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
@@ -22,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -95,7 +94,7 @@ func TestCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCreateParams(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -135,7 +134,7 @@ func TestGetCreateParams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCreateParamsExisting(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -179,7 +178,7 @@ func TestGetCreateParamsExisting(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCreateParamsCurrentDocErr(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -212,7 +211,7 @@ func TestGetCreateParamsCurrentDocErr(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitCreate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -255,7 +254,7 @@ func TestSubmitCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitCreateExists(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package document_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -15,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestListByClientId(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documentstore
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -21,7 +20,7 @@ type ProcessConfig struct {
|
||||
}
|
||||
|
||||
func TestProcess(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &ProcessConfig{}
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documentsync_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -20,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetDocumentText(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
t.Run("Hello World", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documenttext
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -20,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func TestExecuteExtract(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documenttext
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -35,7 +34,7 @@ type DocTextConfig struct {
|
||||
}
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -141,7 +140,7 @@ func TestCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInformClean(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
|
||||
cfg := &DocTextConfig{}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documenttext
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
"testing"
|
||||
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetBasePage(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
cfg := DocTextConfig{}
|
||||
svc := Service{
|
||||
cfg: &cfg,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documenttext
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"io"
|
||||
"strings"
|
||||
@@ -22,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestStoreExtract(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package documenttypes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -15,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestIsValidDPI(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
t.Run("no imgs", func(t *testing.T) {
|
||||
pdf := NewPDF(strings.NewReader(pdfHelloWorld))
|
||||
|
||||
@@ -133,7 +132,7 @@ func TestIsValidDPI(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsValidDimensions(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
pdf := NewPDF(strings.NewReader(pdfHelloWorld))
|
||||
|
||||
@@ -168,7 +167,7 @@ func TestIsValidDimensions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPageCount(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
pdf := NewPDF(strings.NewReader(pdfHelloWorld))
|
||||
|
||||
@@ -186,7 +185,7 @@ func TestGetPageCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsCorrupt(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
t.Run("valid", func(t *testing.T) {
|
||||
pdf := NewPDF(strings.NewReader(pdfHelloWorld))
|
||||
|
||||
@@ -255,7 +254,7 @@ func TestNewPDF(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPDFGetPage(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
t.Run("hello world", func(t *testing.T) {
|
||||
file, err := os.Open("../../../assets/original/version1_7.pdf")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package query_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
@@ -19,7 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -75,7 +74,7 @@ func TestCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateMinimal(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -114,7 +113,7 @@ func TestCreateMinimal(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateRollback(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -74,7 +73,7 @@ func TestParseCreateQueryInvalidType(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitCreate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -126,7 +125,7 @@ func TestSubmitCreate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitCreateNoReqsOrConfig(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -165,7 +164,7 @@ func TestSubmitCreateNoReqsOrConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNormalizeCreate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package query_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -19,7 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -149,7 +148,7 @@ func TestGetWithVersion(t *testing.T) {
|
||||
Addedversion: latestVersion,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
svc := query.New(cfg)
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package query_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -17,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func TestList(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -52,7 +51,7 @@ func TestList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListById(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package query
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
@@ -70,7 +69,7 @@ func TestNormalizeConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNormalizeQueryIDs(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package result
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -140,7 +139,7 @@ func TestProcess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListRequiredValue(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package resultset
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -28,7 +27,7 @@ type ResultSetConfig struct {
|
||||
}
|
||||
|
||||
func TestSet(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -121,7 +120,7 @@ func TestSet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInformQueryDependents(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package resultsync
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -22,7 +21,7 @@ type ResultSyncConfig struct {
|
||||
}
|
||||
|
||||
func TestTriggerSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &ResultSyncConfig{}
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
@@ -53,7 +52,7 @@ func TestTriggerSync(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTriggerMultiSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &ResultSyncConfig{}
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package querysync
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -25,7 +24,7 @@ type QuerySyncConfig struct {
|
||||
}
|
||||
|
||||
func TestSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &QuerySyncConfig{}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package querytest_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/collector"
|
||||
@@ -20,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func TestTest(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package contextfull_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
resultprocessor "queryorchestration/internal/query/result/processor"
|
||||
@@ -13,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestContextFull(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
extractor := contextfull.NewExtractor()
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package jsonextractor_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -19,7 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func TestJSONProcess(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -79,7 +78,7 @@ func TestJSONProcess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestJSONProcessJSON(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
|
||||
@@ -128,7 +127,7 @@ func TestJSONProcessJSON(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestJSONProcessResults(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package queryupdate_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -28,7 +27,7 @@ type QueryUpdateConfig struct {
|
||||
}
|
||||
|
||||
func TestUpdate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package queryupdate
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
@@ -50,7 +49,7 @@ func TestGetUpdator(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitUpdate(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -101,7 +100,7 @@ func TestSubmitUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitUpdateRollback(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -136,7 +135,7 @@ func TestSubmitUpdateRollback(t *testing.T) {
|
||||
func TestSubmitUpdateRequiredQueries(t *testing.T) {
|
||||
t.Run("all fields", func(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -188,7 +187,7 @@ func TestSubmitUpdateRequiredQueries(t *testing.T) {
|
||||
})
|
||||
t.Run("all nil", func(t *testing.T) {
|
||||
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -228,7 +227,7 @@ func TestSubmitUpdateRequiredQueries(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitUpdateActiveVersion(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -274,7 +273,7 @@ func TestGetSetDifference(t *testing.T) {
|
||||
|
||||
func TestNormalizeUpdate(t *testing.T) {
|
||||
t.Run("all fields to change", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -311,7 +310,7 @@ func TestNormalizeUpdate(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("no changes", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -336,7 +335,7 @@ func TestNormalizeUpdate(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("same active version", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -363,7 +362,7 @@ func TestNormalizeUpdate(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("ONLY active version to next latest", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -392,7 +391,7 @@ func TestNormalizeUpdate(t *testing.T) {
|
||||
|
||||
func TestNormalizeUpdateRequiredQueryIDs(t *testing.T) {
|
||||
t.Run("Empty Array", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -420,7 +419,7 @@ func TestNormalizeUpdateRequiredQueryIDs(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("entry doesn't exist", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -450,7 +449,7 @@ func TestNormalizeUpdateRequiredQueryIDs(t *testing.T) {
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("in dependency tree", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
@@ -484,7 +483,7 @@ func TestNormalizeUpdateRequiredQueryIDs(t *testing.T) {
|
||||
assert.Error(t, err)
|
||||
})
|
||||
t.Run("same update and current", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &QueryUpdateConfig{}
|
||||
@@ -525,7 +524,7 @@ func TestNormalizeUpdateRequiredQueryIDs(t *testing.T) {
|
||||
|
||||
func TestInformUpdate(t *testing.T) {
|
||||
t.Run("nil active version", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &QueryUpdateConfig{}
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
@@ -544,7 +543,7 @@ func TestInformUpdate(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
t.Run("update active version", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &QueryUpdateConfig{}
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package queryversionsync
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -25,7 +24,7 @@ type QueryVersionSyncConfig struct {
|
||||
}
|
||||
|
||||
func TestSync(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
pool, err := pgxmock.NewPool()
|
||||
require.NoError(t, err)
|
||||
cfg := &QueryVersionSyncConfig{}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
@@ -24,7 +23,7 @@ func TestNewAPI(t *testing.T) {
|
||||
t.SkipNow()
|
||||
}
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &BaseConfig{}
|
||||
_ = serviceconfig.InitializeConfig(cfg)
|
||||
@@ -126,9 +125,9 @@ func TestGetDebugMiddleware(t *testing.T) {
|
||||
t.Run("debug disabled", func(t *testing.T) {
|
||||
// Save original env and restore after test
|
||||
origDebug := os.Getenv("DEBUG")
|
||||
defer os.Setenv("DEBUG", origDebug)
|
||||
defer t.Setenv("DEBUG", origDebug)
|
||||
|
||||
os.Setenv("DEBUG", "false")
|
||||
t.Setenv("DEBUG", "false")
|
||||
|
||||
// Reset logs
|
||||
l.Logs = nil
|
||||
@@ -163,9 +162,9 @@ func TestGetDebugMiddleware(t *testing.T) {
|
||||
t.Run("debug enabled", func(t *testing.T) {
|
||||
// Save original env and restore after test
|
||||
origDebug := os.Getenv("DEBUG")
|
||||
defer os.Setenv("DEBUG", origDebug)
|
||||
defer t.Setenv("DEBUG", origDebug)
|
||||
|
||||
os.Setenv("DEBUG", "true")
|
||||
t.Setenv("DEBUG", "true")
|
||||
|
||||
// Reset logs
|
||||
l.Logs = nil
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package runner
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
@@ -59,7 +58,7 @@ func TestNewRunner(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListen(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
queue := Server[interface{}]{}
|
||||
|
||||
@@ -81,7 +80,7 @@ func TestRegisterController(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPingQueue(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
c := BaseConfig[interface{}]{}
|
||||
c.QueueURL = "i/am/here"
|
||||
mockSQS := queuemock.NewMockSQSClient(t)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package server_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -19,7 +18,7 @@ func TestNewServer(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &server.BaseConfig{}
|
||||
_ = serviceconfig.InitializeConfig(cfg)
|
||||
|
||||
@@ -26,7 +26,7 @@ func TestInitializeAuthConfig(t *testing.T) {
|
||||
|
||||
// Set environment variables
|
||||
for k, v := range testEnv {
|
||||
os.Setenv(k, v)
|
||||
t.Setenv(k, v)
|
||||
}
|
||||
defer func() {
|
||||
// Cleanup environment variables after test
|
||||
@@ -47,7 +47,6 @@ func TestInitializeAuthConfig(t *testing.T) {
|
||||
// Create config instance
|
||||
cfg := &CognitoConfig{}
|
||||
err := cfg.InitializeAuthConfig(baseURL, testLogger)
|
||||
|
||||
// Test initialization success
|
||||
if err != nil {
|
||||
t.Errorf("InitializeAuthConfig failed: %v", err)
|
||||
@@ -107,10 +106,10 @@ func TestInitializeAuthConfigWithDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
// Set required variables
|
||||
os.Setenv("COGNITO_USER_POOL_ID", "us-east-2_testpool")
|
||||
os.Setenv("COGNITO_CLIENT_ID", "test-client-id")
|
||||
os.Setenv("COGNITO_CLIENT_SECRET", "test-client-secret")
|
||||
os.Setenv("COGNITO_DOMAIN", "test-domain.auth.us-east-2.amazoncognito.com")
|
||||
t.Setenv("COGNITO_USER_POOL_ID", "us-east-2_testpool")
|
||||
t.Setenv("COGNITO_CLIENT_ID", "test-client-id")
|
||||
t.Setenv("COGNITO_CLIENT_SECRET", "test-client-secret")
|
||||
t.Setenv("COGNITO_DOMAIN", "test-domain.auth.us-east-2.amazoncognito.com")
|
||||
|
||||
defer func() {
|
||||
for _, env := range append(envVars, "COGNITO_USER_POOL_ID", "COGNITO_CLIENT_ID", "COGNITO_CLIENT_SECRET", "COGNITO_DOMAIN") {
|
||||
@@ -120,7 +119,6 @@ func TestInitializeAuthConfigWithDefaults(t *testing.T) {
|
||||
|
||||
cfg := &CognitoConfig{}
|
||||
err := cfg.InitializeAuthConfig("https://example.com", nil)
|
||||
|
||||
if err != nil {
|
||||
t.Errorf("InitializeAuthConfig failed: %v", err)
|
||||
}
|
||||
@@ -302,7 +300,7 @@ func TestGettersAndSetters(t *testing.T) {
|
||||
|
||||
func TestPrettyPrintDebugOnly(t *testing.T) {
|
||||
// Test with DEBUG=true
|
||||
os.Setenv("DEBUG", "true")
|
||||
t.Setenv("DEBUG", "true")
|
||||
defer os.Unsetenv("DEBUG")
|
||||
|
||||
cfg := &CognitoConfig{
|
||||
@@ -353,9 +351,8 @@ func TestPrettyPrintDebugOnly(t *testing.T) {
|
||||
}
|
||||
|
||||
// Test with DEBUG=false
|
||||
os.Setenv("DEBUG", "false")
|
||||
t.Setenv("DEBUG", "false")
|
||||
buf.Reset()
|
||||
|
||||
cfg.PrettyPrintDebugOnly()
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package serviceconfig
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -94,10 +93,6 @@ func TestInitializeConfig(t *testing.T) {
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
// Clear environment at the start of each subtest
|
||||
os.Clearenv()
|
||||
|
||||
// Set environment variables for this test case
|
||||
for k, v := range tt.envVars {
|
||||
t.Setenv(k, v)
|
||||
}
|
||||
@@ -139,13 +134,10 @@ func TestInitializeConfig(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
os.Clearenv()
|
||||
|
||||
}
|
||||
|
||||
func TestGetBaseConfig(t *testing.T) {
|
||||
assert.NotNil(t, getBaseConfig(&BaseConfig{}))
|
||||
assert.Nil(t, getBaseConfig(nil))
|
||||
assert.NotNil(t, getBaseConfig(&initializeConfigTestStruct{}))
|
||||
os.Clearenv()
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package serviceconfig_test
|
||||
import (
|
||||
"bytes"
|
||||
"log/slog"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -15,7 +14,6 @@ import (
|
||||
// TestPrintConfigRecursive tests the PrintConfigRecursive function as a blackbox test.
|
||||
func TestPrintConfigRecursive(t *testing.T) {
|
||||
serviceconfig.ResetConfigInitOnceTestOnly()
|
||||
os.Clearenv()
|
||||
envVars := map[string]string{
|
||||
"PGUSER": "postgres",
|
||||
"PGPASSWORD": "password",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package database_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/database/repository"
|
||||
@@ -18,7 +17,7 @@ func TestSetDBPool(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &serviceconfig.BaseConfig{}
|
||||
test.CreateDB(t, cfg)
|
||||
|
||||
@@ -3,7 +3,6 @@ package objectstore_test
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -32,8 +31,7 @@ func TestGetStoreClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStoreClient(t *testing.T) {
|
||||
os.Clearenv()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
c := objectstore.ObjectStoreConfig{}
|
||||
err := c.SetStoreClient(ctx)
|
||||
require.NoError(t, err)
|
||||
@@ -41,7 +39,7 @@ func TestStoreClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPingStoreByName(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
mocks3 := objectstoremock.NewMockS3Client(t)
|
||||
c := objectstore.ObjectStoreConfig{
|
||||
StoreClient: mocks3,
|
||||
@@ -76,7 +74,7 @@ type StoreConfig struct {
|
||||
}
|
||||
|
||||
func TestSetStoreClientAndPingByName(t *testing.T) {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), 100*time.Millisecond)
|
||||
defer cancel()
|
||||
cfg := &StoreConfig{}
|
||||
name := "bucket"
|
||||
@@ -93,7 +91,7 @@ func TestCalculateAndCompareETag(t *testing.T) {
|
||||
t.SkipNow()
|
||||
}
|
||||
t.SkipNow()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &StoreConfig{}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package observability_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
@@ -18,7 +17,7 @@ func TestIsOtelEnabled(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetOtel(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &observability.ObsConfig{
|
||||
EnableOtel: true,
|
||||
|
||||
@@ -37,7 +37,7 @@ func GetFreePortForTesting() (int, error) {
|
||||
|
||||
func TestMetricsIntegration(t *testing.T) {
|
||||
// Create a context with cancellation for the test
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
ctx, cancel := context.WithCancel(t.Context())
|
||||
defer cancel()
|
||||
|
||||
testingPort, errorGettingPort := GetFreePortForTesting()
|
||||
@@ -93,7 +93,7 @@ func TestMetricsIntegration(t *testing.T) {
|
||||
|
||||
// Ensure cleanup after test
|
||||
defer func() {
|
||||
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
shutdownCtx, shutdownCancel := context.WithTimeout(t.Context(), 5*time.Second)
|
||||
defer shutdownCancel()
|
||||
|
||||
if err := metrics.Shutdown(shutdownCtx); err != nil {
|
||||
@@ -173,7 +173,7 @@ func TestMetricsIntegration(t *testing.T) {
|
||||
testingPort, errorGettingPort := GetFreePortForTesting()
|
||||
require.NoError(t, errorGettingPort)
|
||||
|
||||
cancelCtx, cancelFunc := context.WithCancel(context.Background())
|
||||
cancelCtx, cancelFunc := context.WithCancel(t.Context())
|
||||
_, err := New(cancelCtx, MetricsConfig{
|
||||
Namespace: "test_cancel",
|
||||
Port: testingPort,
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package queue_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/serviceconfig/queue"
|
||||
@@ -21,8 +19,7 @@ func TestGetQueueClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetQueueClient(t *testing.T) {
|
||||
os.Clearenv()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
c := queue.QueueConfig{}
|
||||
err := c.SetQueueClient(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package textract_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
textract "queryorchestration/internal/serviceconfig/textract"
|
||||
@@ -20,16 +18,15 @@ func TestGetTextractClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTextractClient(t *testing.T) {
|
||||
os.Clearenv()
|
||||
t.Run("stndard", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
c := textract.TextractConfig{}
|
||||
err := c.SetTextractClient(ctx)
|
||||
require.NoError(t, err)
|
||||
assert.NotNil(t, c.TextractClient)
|
||||
})
|
||||
t.Run("textract specific", func(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
c := textract.TextractConfig{
|
||||
AWSTextractAccessKeyId: "not empty",
|
||||
AWSTextractSecretAccessKey: "not empty",
|
||||
@@ -43,8 +40,7 @@ func TestTextractClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTextractClientWithProfile(t *testing.T) {
|
||||
os.Clearenv()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
c := textract.TextractConfig{}
|
||||
err := c.SetTextractClientWithProfile(ctx, "")
|
||||
require.NoError(t, err)
|
||||
@@ -59,7 +55,6 @@ func TestGetTextractURL(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetTextractURL(t *testing.T) {
|
||||
os.Clearenv()
|
||||
c := textract.TextractConfig{}
|
||||
c.SetTextractEndpoint("example")
|
||||
assert.Equal(t, "example", c.AWSEndpointUrlTextract)
|
||||
|
||||
@@ -34,14 +34,14 @@ 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("")
|
||||
cfg.SetAWSRegion("us-east-1")
|
||||
cfg.SetAWSEndpoint(fmt.Sprintf("http://%s:%d", awsAlias, awsPort))
|
||||
|
||||
network := GetNetwork(t)
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "localstack/localstack:4.1.0",
|
||||
Name: "localstack_test_queryorchestration",
|
||||
|
||||
@@ -39,5 +39,6 @@ func GetNetwork(t testing.TB) string {
|
||||
func getDockerClient(t testing.TB) *client.Client {
|
||||
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
|
||||
require.NoError(t, err)
|
||||
|
||||
return cli
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -26,7 +25,7 @@ func TestCreateBucket(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &StoreConfig{}
|
||||
|
||||
@@ -37,7 +36,7 @@ func TestCreateBucket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPutObject(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &StoreConfig{}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
@@ -27,7 +26,7 @@ func TestCreateQueue(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &TestConfig{}
|
||||
|
||||
@@ -43,7 +42,7 @@ func TestAssertMessageWait(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &TestConfig{}
|
||||
|
||||
@@ -68,7 +67,7 @@ func TestAssertMessageBodyWait(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &TestConfig{}
|
||||
|
||||
@@ -90,7 +89,7 @@ func TestAssertMessageAttrWait(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &TestConfig{}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package endtoend_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
@@ -15,7 +14,7 @@ import (
|
||||
|
||||
func TestQueryAPIAccessories(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &Config{}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package endtoend_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
@@ -14,7 +13,7 @@ import (
|
||||
|
||||
func TestClient(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &Config{}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package endtoend_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"testing"
|
||||
@@ -28,7 +27,7 @@ type Config struct {
|
||||
|
||||
func TestCollectorService(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &Config{}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package endtoend_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
@@ -34,7 +33,7 @@ func TestQueryAPI(t *testing.T) {
|
||||
})
|
||||
t.Run("create and get query", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &Config{}
|
||||
|
||||
@@ -73,7 +72,7 @@ func TestQueryAPI(t *testing.T) {
|
||||
})
|
||||
t.Run("update query", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &Config{}
|
||||
|
||||
@@ -118,7 +117,7 @@ func TestQueryAPI(t *testing.T) {
|
||||
})
|
||||
t.Run("multiple dependent queries", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
ctx := t.Context()
|
||||
|
||||
cfg := &Config{}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user