Skip to content

Commit

Permalink
Prefix sidecar proxy test files with source and destination.
Browse files Browse the repository at this point in the history
  • Loading branch information
hc-github-team-consul-core authored and jmurret committed Sep 8, 2023
1 parent df7b6cd commit 22bbfca
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 286 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,3 @@ func findMeshPort(ports map[string]*pbcatalog.WorkloadPort) string {
}
return ""
}

func findMeshPort(ports map[string]*pbcatalog.WorkloadPort) string {
for name, port := range ports {
if port.Protocol == pbcatalog.Protocol_PROTOCOL_MESH {
return name
}
}
return ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,26 +87,29 @@ func TestBuildExplicitDestinations(t *testing.T) {
cases := map[string]struct {
destinations []*intermediate.Destination
}{
"l4-single-destination-ip-port-bind-address": {
"destination/l4-single-destination-ip-port-bind-address": {
destinations: []*intermediate.Destination{destinationIpPort},
},
"l4-single-destination-unix-socket-bind-address": {
"destination/l4-single-destination-unix-socket-bind-address": {
destinations: []*intermediate.Destination{destinationUnix},
},
"l4-multi-destination": {
"destination/l4-multi-destination": {
destinations: []*intermediate.Destination{destinationIpPort, destinationUnix},
},
}

for name, c := range cases {
proxyTmpl := New(testProxyStateTemplateID(), testIdentityRef(), "foo.consul", "dc1", nil).
BuildDestinations(c.destinations).
Build()
t.Run(name, func(t *testing.T) {

actual := protoToJSON(t, proxyTmpl)
expected := golden.Get(t, actual, name)
proxyTmpl := New(testProxyStateTemplateID(), testIdentityRef(), "foo.consul", "dc1", nil).
BuildDestinations(c.destinations).
Build()

require.JSONEq(t, expected, actual)
actual := protoToJSON(t, proxyTmpl)
expected := golden.Get(t, actual, name+".golden")

require.JSONEq(t, expected, actual)
})
}
}

Expand Down Expand Up @@ -180,13 +183,13 @@ func TestBuildImplicitDestinations(t *testing.T) {
cases := map[string]struct {
destinations []*intermediate.Destination
}{
"l4-single-implicit-destination-tproxy": {
"destination/l4-single-implicit-destination-tproxy": {
destinations: []*intermediate.Destination{destination1},
},
"l4-multiple-implicit-destinations-tproxy": {
"destination/l4-multiple-implicit-destinations-tproxy": {
destinations: []*intermediate.Destination{destination1, destination2},
},
"l4-implicit-and-explicit-destinations-tproxy": {
"destination/l4-implicit-and-explicit-destinations-tproxy": {
destinations: []*intermediate.Destination{destination2, destination3},
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestBuildLocalApp(t *testing.T) {
cases := map[string]struct {
workload *pbcatalog.Workload
}{
"l4-single-workload-address-without-ports": {
"source/l4-single-workload-address-without-ports": {
workload: &pbcatalog.Workload{
Addresses: []*pbcatalog.WorkloadAddress{
{
Expand All @@ -33,7 +33,7 @@ func TestBuildLocalApp(t *testing.T) {
},
},
},
"l4-multiple-workload-addresses-without-ports": {
"source/l4-multiple-workload-addresses-without-ports": {
workload: &pbcatalog.Workload{
Addresses: []*pbcatalog.WorkloadAddress{
{
Expand All @@ -49,7 +49,7 @@ func TestBuildLocalApp(t *testing.T) {
},
},
},
"l4-multiple-workload-addresses-with-specific-ports": {
"source/l4-multiple-workload-addresses-with-specific-ports": {
workload: &pbcatalog.Workload{
Addresses: []*pbcatalog.WorkloadAddress{
{
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 22bbfca

Please sign in to comment.