github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/drivers/docker/ports_test.go (about)

     1  package docker
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/nomad/ci"
     7  	"github.com/hashicorp/nomad/helper/testlog"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestPublishedPorts_add(t *testing.T) {
    12  	ci.Parallel(t)
    13  
    14  	p := newPublishedPorts(testlog.HCLogger(t))
    15  	p.add("label", "10.0.0.1", 1234, 80)
    16  	p.add("label", "10.0.0.1", 5678, 80)
    17  	for _, bindings := range p.publishedPorts {
    18  		require.Len(t, bindings, 2)
    19  	}
    20  	require.Len(t, p.exposedPorts, 2)
    21  }