2021-02-03 03:54:23 +00:00
|
|
|
package docker
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-03-15 12:42:43 +00:00
|
|
|
"github.com/hashicorp/nomad/ci"
|
2021-02-03 03:54:23 +00:00
|
|
|
"github.com/hashicorp/nomad/helper/testlog"
|
2022-03-15 12:42:43 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
2021-02-03 03:54:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestPublishedPorts_add(t *testing.T) {
|
2022-03-15 12:42:43 +00:00
|
|
|
ci.Parallel(t)
|
|
|
|
|
2021-02-03 03:54:23 +00:00
|
|
|
p := newPublishedPorts(testlog.HCLogger(t))
|
|
|
|
p.add("label", "10.0.0.1", 1234, 80)
|
|
|
|
p.add("label", "10.0.0.1", 5678, 80)
|
|
|
|
for _, bindings := range p.publishedPorts {
|
|
|
|
require.Len(t, bindings, 2)
|
|
|
|
}
|
|
|
|
require.Len(t, p.exposedPorts, 2)
|
|
|
|
}
|