Merged in feature/docinitialisation (pull request #41)

Queuing Changes and Cfg Testing

* staarting

* staarting

* startedpush

* note

* save

* mocking

* removederrs

* fixtests

* cleanuperrs

* newenvsetup

* preppingtests

* queue

* mmovetocfgpassunittests

* sortoutconfig

* passinginteg

* deps

* fixtests
This commit is contained in:
Michael McGuinness
2025-02-03 17:30:50 +00:00
parent 15adaebfcd
commit 7001ca854c
135 changed files with 3916 additions and 1523 deletions
@@ -0,0 +1,51 @@
package queue_test
import (
"context"
"os"
"queryorchestration/internal/serviceconfig/queue"
queuemock "queryorchestration/mocks/queue"
"testing"
"github.com/aws/aws-sdk-go-v2/service/sqs"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
func TestGetQueueClient(t *testing.T) {
c := queue.QueueConfig{}
assert.Nil(t, c.GetQueueClient())
c.QueueClient = &sqs.Client{}
assert.Equal(t, &sqs.Client{}, c.GetQueueClient())
}
func TestSetQueueClient(t *testing.T) {
os.Clearenv()
ctx := context.Background()
c := queue.QueueConfig{}
err := c.SetQueueClient(ctx)
assert.NoError(t, err)
assert.NotNil(t, c.QueueClient)
}
func TestPingQueueByURL(t *testing.T) {
ctx := context.Background()
mockSQS := queuemock.NewMockSQSClient(t)
c := queue.QueueConfig{
QueueClient: mockSQS,
}
url := "i/am/here"
mockSQS.EXPECT().
GetQueueAttributes(
mock.Anything,
mock.MatchedBy(func(in *sqs.GetQueueAttributesInput) bool {
return *in.QueueUrl == url
}),
mock.Anything,
).
Return(&sqs.GetQueueAttributesOutput{}, nil)
err := c.PingQueueByURL(ctx, url)
assert.NoError(t, err)
}