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

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