github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/drivers/docker/ports_test.go (about)

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