forked from LaconicNetwork/kompose
Fix expose conversion (#1696)
* fix: remove hostport from expose conversion Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com> * test: update unit tests Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com> --------- Signed-off-by: AhmedGrati <ahmedgrati1999@gmail.com>
This commit is contained in:
parent
0fa1c1e032
commit
0be4868914
@ -288,7 +288,6 @@ func loadPorts(ports []types.ServicePortConfig, expose []string) []kobject.Ports
|
||||
continue
|
||||
}
|
||||
komposePorts = append(komposePorts, kobject.Ports{
|
||||
HostPort: cast.ToInt32(portValue),
|
||||
ContainerPort: cast.ToInt32(portValue),
|
||||
HostIP: "",
|
||||
Protocol: strings.ToUpper(protocol),
|
||||
|
||||
@ -221,7 +221,7 @@ func TestLoadV3Ports(t *testing.T) {
|
||||
expose: []string{"80", "8080"},
|
||||
want: []kobject.Ports{
|
||||
{HostPort: 80, ContainerPort: 80, Protocol: string(api.ProtocolTCP)},
|
||||
{HostPort: 8080, ContainerPort: 8080, Protocol: string(api.ProtocolTCP)},
|
||||
{ContainerPort: 8080, Protocol: string(api.ProtocolTCP)},
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -230,7 +230,7 @@ func TestLoadV3Ports(t *testing.T) {
|
||||
expose: []string{"80/udp"},
|
||||
want: []kobject.Ports{
|
||||
{HostPort: 80, ContainerPort: 80, Protocol: string(api.ProtocolTCP)},
|
||||
{HostPort: 80, ContainerPort: 80, Protocol: string(api.ProtocolUDP)},
|
||||
{ContainerPort: 80, Protocol: string(api.ProtocolUDP)},
|
||||
},
|
||||
},
|
||||
} {
|
||||
@ -347,8 +347,8 @@ func TestLoadPorts(t *testing.T) {
|
||||
want: []kobject.Ports{
|
||||
{ContainerPort: 80, Protocol: string(api.ProtocolTCP)},
|
||||
{ContainerPort: 3000, Protocol: string(api.ProtocolTCP)},
|
||||
{HostPort: 80, ContainerPort: 80, Protocol: string(api.ProtocolTCP)},
|
||||
{HostPort: 8080, ContainerPort: 8080, Protocol: string(api.ProtocolTCP)},
|
||||
{ContainerPort: 80, Protocol: string(api.ProtocolTCP)},
|
||||
{ContainerPort: 8080, Protocol: string(api.ProtocolTCP)},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user