mirror of https://github.com/hashicorp/consul
Make new gateway tests compatible with enterprise (#7856)
parent
4344daf62b
commit
7a7760bfd5
|
@ -1279,20 +1279,22 @@ func TestInternal_GatewayServiceDump_Terminating(t *testing.T) {
|
||||||
Passing: 1,
|
Passing: 1,
|
||||||
Warning: 1,
|
Warning: 1,
|
||||||
},
|
},
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
Checks: structs.HealthChecks{
|
Checks: structs.HealthChecks{
|
||||||
{
|
{
|
||||||
Node: "baz",
|
Node: "baz",
|
||||||
CheckID: types.CheckID("db2-passing"),
|
CheckID: types.CheckID("db2-passing"),
|
||||||
Name: "db2-passing",
|
Name: "db2-passing",
|
||||||
Status: "passing",
|
Status: "passing",
|
||||||
ServiceID: "db2",
|
ServiceID: "db2",
|
||||||
ServiceName: "db",
|
ServiceName: "db",
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
GatewayService: &structs.GatewayService{
|
GatewayService: &structs.GatewayService{
|
||||||
Gateway: structs.ServiceID{ID: "terminating-gateway"},
|
Gateway: structs.NewServiceID("terminating-gateway", nil),
|
||||||
Service: structs.ServiceID{ID: "db"},
|
Service: structs.NewServiceID("db", nil),
|
||||||
GatewayKind: "terminating-gateway",
|
GatewayKind: "terminating-gateway",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1309,28 +1311,30 @@ func TestInternal_GatewayServiceDump_Terminating(t *testing.T) {
|
||||||
Passing: 1,
|
Passing: 1,
|
||||||
Warning: 1,
|
Warning: 1,
|
||||||
},
|
},
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
Checks: structs.HealthChecks{
|
Checks: structs.HealthChecks{
|
||||||
{
|
{
|
||||||
Node: "bar",
|
Node: "bar",
|
||||||
CheckID: types.CheckID("db-warning"),
|
CheckID: types.CheckID("db-warning"),
|
||||||
Name: "db-warning",
|
Name: "db-warning",
|
||||||
Status: "warning",
|
Status: "warning",
|
||||||
ServiceID: "db",
|
ServiceID: "db",
|
||||||
ServiceName: "db",
|
ServiceName: "db",
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
GatewayService: &structs.GatewayService{
|
GatewayService: &structs.GatewayService{
|
||||||
Gateway: structs.ServiceID{ID: "terminating-gateway"},
|
Gateway: structs.NewServiceID("terminating-gateway", nil),
|
||||||
Service: structs.ServiceID{ID: "db"},
|
Service: structs.NewServiceID("db", nil),
|
||||||
GatewayKind: "terminating-gateway",
|
GatewayKind: "terminating-gateway",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Only GatewayService should be returned when linked service isn't registered
|
// Only GatewayService should be returned when linked service isn't registered
|
||||||
GatewayService: &structs.GatewayService{
|
GatewayService: &structs.GatewayService{
|
||||||
Gateway: structs.ServiceID{ID: "terminating-gateway"},
|
Gateway: structs.NewServiceID("terminating-gateway", nil),
|
||||||
Service: structs.ServiceID{ID: "redis"},
|
Service: structs.NewServiceID("redis", nil),
|
||||||
GatewayKind: "terminating-gateway",
|
GatewayKind: "terminating-gateway",
|
||||||
CAFile: "/etc/certs/ca.pem",
|
CAFile: "/etc/certs/ca.pem",
|
||||||
CertFile: "/etc/certs/cert.pem",
|
CertFile: "/etc/certs/cert.pem",
|
||||||
|
@ -1608,20 +1612,22 @@ func TestInternal_GatewayServiceDump_Ingress(t *testing.T) {
|
||||||
Passing: 1,
|
Passing: 1,
|
||||||
Warning: 1,
|
Warning: 1,
|
||||||
},
|
},
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
Checks: structs.HealthChecks{
|
Checks: structs.HealthChecks{
|
||||||
{
|
{
|
||||||
Node: "bar",
|
Node: "bar",
|
||||||
CheckID: types.CheckID("db-warning"),
|
CheckID: types.CheckID("db-warning"),
|
||||||
Name: "db-warning",
|
Name: "db-warning",
|
||||||
Status: "warning",
|
Status: "warning",
|
||||||
ServiceID: "db",
|
ServiceID: "db",
|
||||||
ServiceName: "db",
|
ServiceName: "db",
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
GatewayService: &structs.GatewayService{
|
GatewayService: &structs.GatewayService{
|
||||||
Gateway: structs.ServiceID{ID: "ingress-gateway"},
|
Gateway: structs.NewServiceID("ingress-gateway", nil),
|
||||||
Service: structs.ServiceID{ID: "db"},
|
Service: structs.NewServiceID("db", nil),
|
||||||
GatewayKind: "ingress-gateway",
|
GatewayKind: "ingress-gateway",
|
||||||
Port: 8888,
|
Port: 8888,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
|
@ -1640,20 +1646,22 @@ func TestInternal_GatewayServiceDump_Ingress(t *testing.T) {
|
||||||
Passing: 1,
|
Passing: 1,
|
||||||
Warning: 1,
|
Warning: 1,
|
||||||
},
|
},
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
Checks: structs.HealthChecks{
|
Checks: structs.HealthChecks{
|
||||||
{
|
{
|
||||||
Node: "baz",
|
Node: "baz",
|
||||||
CheckID: types.CheckID("db2-passing"),
|
CheckID: types.CheckID("db2-passing"),
|
||||||
Name: "db2-passing",
|
Name: "db2-passing",
|
||||||
Status: "passing",
|
Status: "passing",
|
||||||
ServiceID: "db2",
|
ServiceID: "db2",
|
||||||
ServiceName: "db",
|
ServiceName: "db",
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
GatewayService: &structs.GatewayService{
|
GatewayService: &structs.GatewayService{
|
||||||
Gateway: structs.ServiceID{ID: "ingress-gateway"},
|
Gateway: structs.NewServiceID("ingress-gateway", nil),
|
||||||
Service: structs.ServiceID{ID: "db"},
|
Service: structs.NewServiceID("db", nil),
|
||||||
GatewayKind: "ingress-gateway",
|
GatewayKind: "ingress-gateway",
|
||||||
Port: 8888,
|
Port: 8888,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
|
@ -1662,8 +1670,8 @@ func TestInternal_GatewayServiceDump_Ingress(t *testing.T) {
|
||||||
{
|
{
|
||||||
// Only GatewayService should be returned when upstream isn't registered
|
// Only GatewayService should be returned when upstream isn't registered
|
||||||
GatewayService: &structs.GatewayService{
|
GatewayService: &structs.GatewayService{
|
||||||
Gateway: structs.ServiceID{ID: "ingress-gateway"},
|
Gateway: structs.NewServiceID("ingress-gateway", nil),
|
||||||
Service: structs.ServiceID{ID: "web"},
|
Service: structs.NewServiceID("web", nil),
|
||||||
GatewayKind: "ingress-gateway",
|
GatewayKind: "ingress-gateway",
|
||||||
Port: 8080,
|
Port: 8080,
|
||||||
Protocol: "tcp",
|
Protocol: "tcp",
|
||||||
|
|
|
@ -515,7 +515,8 @@ func TestUIGatewayServiceNodes_Terminating(t *testing.T) {
|
||||||
dump := obj.([]*ServiceSummary)
|
dump := obj.([]*ServiceSummary)
|
||||||
expect := []*ServiceSummary{
|
expect := []*ServiceSummary{
|
||||||
{
|
{
|
||||||
Name: "redis",
|
Name: "redis",
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "db",
|
Name: "db",
|
||||||
|
@ -525,6 +526,7 @@ func TestUIGatewayServiceNodes_Terminating(t *testing.T) {
|
||||||
ChecksPassing: 1,
|
ChecksPassing: 1,
|
||||||
ChecksWarning: 1,
|
ChecksWarning: 1,
|
||||||
ChecksCritical: 0,
|
ChecksCritical: 0,
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
assert.ElementsMatch(t, expect, dump)
|
assert.ElementsMatch(t, expect, dump)
|
||||||
|
@ -637,8 +639,9 @@ func TestUIGatewayServiceNodes_Ingress(t *testing.T) {
|
||||||
dump := obj.([]*ServiceSummary)
|
dump := obj.([]*ServiceSummary)
|
||||||
expect := []*ServiceSummary{
|
expect := []*ServiceSummary{
|
||||||
{
|
{
|
||||||
Name: "web",
|
Name: "web",
|
||||||
GatewayConfig: GatewayConfig{ListenerPort: 8080},
|
GatewayConfig: GatewayConfig{ListenerPort: 8080},
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "db",
|
Name: "db",
|
||||||
|
@ -649,6 +652,7 @@ func TestUIGatewayServiceNodes_Ingress(t *testing.T) {
|
||||||
ChecksWarning: 1,
|
ChecksWarning: 1,
|
||||||
ChecksCritical: 0,
|
ChecksCritical: 0,
|
||||||
GatewayConfig: GatewayConfig{ListenerPort: 8888},
|
GatewayConfig: GatewayConfig{ListenerPort: 8888},
|
||||||
|
EnterpriseMeta: *structs.DefaultEnterpriseMeta(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
assert.ElementsMatch(t, expect, dump)
|
assert.ElementsMatch(t, expect, dump)
|
||||||
|
|
Loading…
Reference in New Issue