Files
docker-machine/drivers/azure/util_test.go
André Carvalho 270219e848 azure: add support for custom protocol in --azure-open-port
This makes the --azure-open-port flag behave like
--amazonec2-open-port flag, enabling the user to provide a
protocol for the port, in the format port/protocol.

Signed-off-by: André Carvalho <andre.carvalho@corp.globo.com>
2016-08-20 16:39:52 -03:00

32 lines
629 B
Go

package azure
import (
"testing"
"github.com/Azure/azure-sdk-for-go/arm/network"
"github.com/stretchr/testify/assert"
)
func TestParseSecurityRuleProtocol(t *testing.T) {
tests := []struct {
raw string
expectedProto network.SecurityRuleProtocol
expectedErr bool
}{
{"tcp", network.TCP, false},
{"udp", network.UDP, false},
{"*", network.Asterisk, false},
{"Invalid", "", true},
}
for _, tc := range tests {
proto, err := parseSecurityRuleProtocol(tc.raw)
assert.Equal(t, tc.expectedProto, proto)
if tc.expectedErr {
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
}
}