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

     1  package integration
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  
     7  	"github.com/Jeffail/benthos/v3/internal/integration"
     8  )
     9  
    10  var _ = registerIntegrationTest("nanomsg", func(t *testing.T) {
    11  	t.Parallel()
    12  
    13  	template := `
    14  output:
    15    nanomsg:
    16      urls:
    17        - tcp://localhost:$PORT
    18      bind: false
    19      socket_type: $VAR1
    20      poll_timeout: 5s
    21      max_in_flight: $MAX_IN_FLIGHT
    22  
    23  input:
    24    nanomsg:
    25      urls:
    26        - tcp://*:$PORT
    27      bind: true
    28      socket_type: $VAR2
    29      sub_filters: [ $VAR3 ]
    30  `
    31  	suite := integration.StreamTests(
    32  		integration.StreamTestOpenClose(),
    33  		integration.StreamTestSendBatch(10),
    34  		integration.StreamTestStreamParallel(100),
    35  	)
    36  	suite.Run(
    37  		t, template,
    38  		integration.StreamTestOptSleepAfterInput(500*time.Millisecond),
    39  		integration.StreamTestOptSleepAfterOutput(500*time.Millisecond),
    40  		integration.StreamTestOptVarOne("PUSH"),
    41  		integration.StreamTestOptVarTwo("PULL"),
    42  	)
    43  	t.Run("with max in flight", func(t *testing.T) {
    44  		t.Parallel()
    45  		suite.Run(
    46  			t, template,
    47  			integration.StreamTestOptSleepAfterInput(500*time.Millisecond),
    48  			integration.StreamTestOptSleepAfterOutput(500*time.Millisecond),
    49  			integration.StreamTestOptVarOne("PUSH"),
    50  			integration.StreamTestOptVarTwo("PULL"),
    51  			integration.StreamTestOptMaxInFlight(10),
    52  		)
    53  	})
    54  	t.Run("with pub sub", func(t *testing.T) {
    55  		t.Parallel()
    56  		suite.Run(
    57  			t, template,
    58  			integration.StreamTestOptSleepAfterInput(500*time.Millisecond),
    59  			integration.StreamTestOptSleepAfterOutput(500*time.Millisecond),
    60  			integration.StreamTestOptVarOne("PUB"),
    61  			integration.StreamTestOptVarTwo("SUB"),
    62  			integration.StreamTestOptVarThree(`""`),
    63  		)
    64  	})
    65  })