mirror of
https://github.com/docker/compose.git
synced 2025-07-22 13:14:29 +02:00
LB Type tests
Signed-off-by: aiordache <anca.iordache@docker.com> Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
1d11e847fb
commit
2c190f11f7
@ -4,9 +4,13 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/aws/aws-sdk-go/service/elbv2"
|
||||||
"github.com/awslabs/goformation/v4/cloudformation"
|
"github.com/awslabs/goformation/v4/cloudformation"
|
||||||
"github.com/awslabs/goformation/v4/cloudformation/ec2"
|
"github.com/awslabs/goformation/v4/cloudformation/ec2"
|
||||||
"github.com/awslabs/goformation/v4/cloudformation/iam"
|
"github.com/awslabs/goformation/v4/cloudformation/iam"
|
||||||
|
|
||||||
|
"github.com/awslabs/goformation/v4/cloudformation"
|
||||||
|
"github.com/awslabs/goformation/v4/cloudformation/elasticloadbalancingv2"
|
||||||
"github.com/compose-spec/compose-go/loader"
|
"github.com/compose-spec/compose-go/loader"
|
||||||
"github.com/compose-spec/compose-go/types"
|
"github.com/compose-spec/compose-go/types"
|
||||||
"github.com/docker/ecs-plugin/pkg/compose"
|
"github.com/docker/ecs-plugin/pkg/compose"
|
||||||
@ -69,6 +73,36 @@ networks:
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestLoadBalancerTypeApplication(t *testing.T) {
|
||||||
|
template := convertYaml(t, `
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
test:
|
||||||
|
image: nginx
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
`)
|
||||||
|
lb := template.Resources["TestLoadBalancer"].(*elasticloadbalancingv2.LoadBalancer)
|
||||||
|
assert.Check(t, lb != nil)
|
||||||
|
assert.Check(t, lb.Type == elbv2.LoadBalancerTypeEnumApplication)
|
||||||
|
assert.Check(t, len(lb.SecurityGroups) > 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestLoadBalancerTypeNetwork(t *testing.T) {
|
||||||
|
template := convertYaml(t, `
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
test:
|
||||||
|
image: nginx
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 88:88
|
||||||
|
`)
|
||||||
|
lb := template.Resources["TestLoadBalancer"].(*elasticloadbalancingv2.LoadBalancer)
|
||||||
|
assert.Check(t, lb != nil)
|
||||||
|
assert.Check(t, lb.Type == elbv2.LoadBalancerTypeEnumNetwork)
|
||||||
|
}
|
||||||
|
|
||||||
func convertResultAsString(t *testing.T, project *compose.Project, clusterName string) string {
|
func convertResultAsString(t *testing.T, project *compose.Project, clusterName string) string {
|
||||||
client, err := NewClient("", clusterName, "")
|
client, err := NewClient("", clusterName, "")
|
||||||
assert.NilError(t, err)
|
assert.NilError(t, err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user