forked from LaconicNetwork/kompose
Add unit test for komposeConvert
This commit is contained in:
@@ -20,6 +20,8 @@ import (
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/docker/api/client/bundlefile"
|
||||
"github.com/skippbox/kompose/pkg/kobject"
|
||||
@@ -78,14 +80,14 @@ func loadEnvVarsfromBundle(service bundlefile.Service) ([]kobject.EnvVar, string
|
||||
func loadPortsfromBundle(service bundlefile.Service) ([]kobject.Ports, string) {
|
||||
ports := []kobject.Ports{}
|
||||
for _, port := range service.Ports {
|
||||
var p kobject.Protocol
|
||||
var p api.Protocol
|
||||
switch port.Protocol {
|
||||
default:
|
||||
p = kobject.ProtocolTCP
|
||||
p = api.ProtocolTCP
|
||||
case "TCP":
|
||||
p = kobject.ProtocolTCP
|
||||
p = api.ProtocolTCP
|
||||
case "UDP":
|
||||
p = kobject.ProtocolUDP
|
||||
p = api.ProtocolUDP
|
||||
}
|
||||
ports = append(ports, kobject.Ports{
|
||||
HostPort: int32(port.Port),
|
||||
|
||||
@@ -22,6 +22,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/docker/libcompose/config"
|
||||
"github.com/docker/libcompose/docker"
|
||||
@@ -50,7 +52,7 @@ func loadPortsFromCompose(composePorts []string) ([]kobject.Ports, string) {
|
||||
ports := []kobject.Ports{}
|
||||
character := ":"
|
||||
for _, port := range composePorts {
|
||||
p := kobject.ProtocolTCP
|
||||
p := api.ProtocolTCP
|
||||
if strings.Contains(port, character) {
|
||||
hostPort := port[0:strings.Index(port, character)]
|
||||
hostPort = strings.TrimSpace(hostPort)
|
||||
|
||||
Reference in New Issue
Block a user