Skip to content

Commit

Permalink
fix: reduce example change
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Meier <[email protected]>
  • Loading branch information
astromechza committed Feb 26, 2024
1 parent cfba84f commit 909a449
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion e2e-tests/resources/outputs/example-04-extras-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ services:
ports:
- target: 80
published: "8000"
protocol: tcp
volumes:
- type: volume
source: data
Expand Down
6 changes: 3 additions & 3 deletions internal/compose/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ func ConvertSpec(spec *score.Workload) (*compose.Project, ExternalVariables, err
ports = []compose.ServicePortConfig{}
for _, pSpec := range spec.Service.Ports {
var pubPort = fmt.Sprintf("%v", pSpec.Port)
var protocol = score.ServicePortProtocolTCP
var protocol string
if pSpec.Protocol != nil {
protocol = *pSpec.Protocol
protocol = strings.ToLower(string(*pSpec.Protocol))
}
ports = append(ports, compose.ServicePortConfig{
Published: pubPort,
Target: uint32(DerefOr(pSpec.TargetPort, pSpec.Port)),
Protocol: strings.ToLower(string(protocol)),
Protocol: protocol,
})
}
}
Expand Down
7 changes: 3 additions & 4 deletions internal/compose/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,11 @@ func TestScoreConvert(t *testing.T) {
{
Published: "80",
Target: 8080,
Protocol: "TCP",
},
{
Published: "8080",
Target: 8080,
Protocol: "UDP",
Protocol: "udp",
},
},
},
Expand Down Expand Up @@ -200,8 +199,8 @@ func TestScoreConvert(t *testing.T) {
"PORT": stringPtr("81"),
},
Ports: []compose.ServicePortConfig{
{Target: 80, Published: "8080", Protocol: "TCP"},
{Target: 81, Published: "8081", Protocol: "TCP"},
{Target: 80, Published: "8080"},
{Target: 81, Published: "8081"},
},
},
{
Expand Down

0 comments on commit 909a449

Please sign in to comment.