github.com/Jeffail/benthos/v3@v3.65.0/lib/test/integration/kinesis_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  	"time"
     7  
     8  	"github.com/Jeffail/benthos/v3/internal/integration"
     9  	"github.com/ory/dockertest/v3"
    10  	"github.com/stretchr/testify/assert"
    11  	"github.com/stretchr/testify/require"
    12  )
    13  
    14  var _ = registerIntegrationTest("kinesis", func(t *testing.T) {
    15  	// Skip until annoying logs can be removed.
    16  	t.Skip()
    17  
    18  	t.Parallel()
    19  
    20  	pool, err := dockertest.NewPool("")
    21  	require.NoError(t, err)
    22  
    23  	pool.MaxWait = time.Second * 30
    24  
    25  	resource, err := pool.RunWithOptions(&dockertest.RunOptions{
    26  		Repository:   "localstack/localstack",
    27  		ExposedPorts: []string{"4566/tcp"},
    28  		Env:          []string{"SERVICES=dynamodb,kinesis"},
    29  	})
    30  	require.NoError(t, err)
    31  	t.Cleanup(func() {
    32  		assert.NoError(t, pool.Purge(resource))
    33  	})
    34  
    35  	resource.Expire(900)
    36  
    37  	require.NoError(t, pool.Retry(func() error {
    38  		return createKinesisShards(context.Background(), resource.GetPort("4566/tcp"), "testtable", 2)
    39  	}))
    40  
    41  	template := `
    42  output:
    43    kinesis:
    44      endpoint: http://localhost:$PORT
    45      region: us-east-1
    46      stream: stream-$ID
    47      partition_key: ${! uuid_v4() }
    48      credentials:
    49        id: xxxxx
    50        secret: xxxxx
    51        token: xxxxx
    52      batching:
    53        count: $OUTPUT_BATCH_COUNT
    54  
    55  input:
    56    kinesis_balanced:
    57      endpoint: http://localhost:$PORT
    58      stream: stream-$ID
    59      dynamodb_table: stream-$ID
    60      start_from_oldest: true
    61      region: us-east-1
    62      credentials:
    63        id: xxxxx
    64        secret: xxxxx
    65        token: xxxxx
    66  `
    67  	integration.StreamTests(
    68  		integration.StreamTestOpenClose(),
    69  		// integration.StreamTestMetadata(),
    70  		integration.StreamTestSendBatch(10),
    71  		integration.StreamTestSendBatchCount(10),
    72  		integration.StreamTestStreamSequential(10),
    73  		integration.StreamTestStreamParallel(10),
    74  		integration.StreamTestStreamParallelLossy(10),
    75  		integration.StreamTestStreamParallelLossyThroughReconnect(10),
    76  	).Run(
    77  		t, template,
    78  		integration.StreamTestOptPreTest(func(t testing.TB, ctx context.Context, testID string, vars *integration.StreamTestConfigVars) {
    79  			require.NoError(t, createKinesisShards(ctx, resource.GetPort("4566/tcp"), testID, 2))
    80  		}),
    81  		integration.StreamTestOptPort(resource.GetPort("4566/tcp")),
    82  		integration.StreamTestOptAllowDupes(),
    83  	)
    84  })