Files
query-orchestration/internal/server/runner/poll_test.go
T
Jay Brown 15adaebfcd Merged in feature/serviceconfig-integration (pull request #38)
DRAFT PR : WIP working through ideas for integration

* movearound

* attempttwo

* openapi

* further sanding

* fix

* start on tests

* runthroughsingleconfig

* somechanges

* reflectissue

* removeerrs

* mostlyremovepanic

* removeenv

* noncfgtests

* go

* repo

* fix service config test

* add PWD to all

* test fix

* fix lint

* todo for later

* passingunittests

* alltests

* testlogger

* testloggername

* clean
2025-01-31 13:43:55 +00:00

59 lines
1.2 KiB
Go

package runner
import (
"context"
"queryorchestration/internal/test"
"testing"
"time"
"github.com/aws/aws-sdk-go-v2/service/sqs/types"
"github.com/stretchr/testify/assert"
)
type MockController struct{}
func (s *MockController) Process(ctx context.Context, req *types.Message) error {
return nil
}
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()
controller := MockController{}
ctx, cancel := context.WithTimeout(ctx, time.Second)
defer cancel()
cfg := &Server{
controller: &controller,
queueURL: queueConfig.URL,
client: queueConfig.Client,
cleanup: func() error { return nil },
}
cfg.Listen(ctx)
}
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()
controller := MockController{}
cfg := &Server{
controller: &controller,
queueURL: queueConfig.URL,
client: queueConfig.Client,
}
err := cfg.pollMessage(ctx)
assert.Nil(t, err)
}