github.com/hernad/nomad@v1.6.112/drivers/docker/ports_test.go (about)

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