Skip to content

Commit

Permalink
Merge from master.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nghia Tran committed Aug 2, 2018
1 parent 7485b5d commit 68d9d9a
Showing 1 changed file with 0 additions and 72 deletions.
72 changes: 0 additions & 72 deletions pkg/controller/route/resources/virtual_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,35 +82,6 @@ func TestMakeVirtualServiceSpec_CorrectSpec(t *testing.T) {
}
}

func TestMakeVirtualServiceSpec_CorrectLocalSpec(t *testing.T) {
targets := map[string][]traffic.RevisionTarget{}
r := &v1alpha1.Route{
ObjectMeta: metav1.ObjectMeta{
Name: "test-route",
Namespace: "test-ns",
Labels: map[string]string{"route": "test-route"},
},
Status: v1alpha1.RouteStatus{Domain: "test-route.test-ns.svc.cluster.local"},
}
expected := v1alpha3.VirtualServiceSpec{
// We want to connect to two Gateways: the Route's ingress Gateway, and the 'mesh' Gateway. The former
// provides access from outside of the cluster, and the latter provides access for services from inside
// the cluster.
Gateways: []string{
"knative-shared-gateway.knative-serving.svc.cluster.local",
"mesh",
},
Hosts: []string{
"*.test-route.test-ns.svc.cluster.local",
"test-route.test-ns.svc.cluster.local",
},
}
routes := MakeVirtualService(r, &traffic.TrafficConfig{Targets: targets}).Spec
if diff := cmp.Diff(expected, routes); diff != "" {
t.Errorf("Unexpected routes (-want +got): %v", diff)
}
}

func TestMakeVirtualServiceSpec_CorrectRoutes(t *testing.T) {
targets := map[string][]traffic.RevisionTarget{
"": {{
Expand Down Expand Up @@ -179,49 +150,6 @@ func TestMakeVirtualServiceSpec_CorrectRoutes(t *testing.T) {
}
}

func TestMakeVirtualServiceSpec_CorrectLocalRoutes(t *testing.T) {
targets := map[string][]traffic.RevisionTarget{
"": {{
TrafficTarget: v1alpha1.TrafficTarget{
ConfigurationName: "config",
RevisionName: "v2",
Percent: 100,
},
Active: true,
}},
}
r := &v1alpha1.Route{
ObjectMeta: metav1.ObjectMeta{
Name: "test-route",
Namespace: "test-ns",
Labels: map[string]string{"route": "test-route"},
},
Status: v1alpha1.RouteStatus{Domain: "test-route.test-ns.svc.cluster.local"},
}
expected := []v1alpha3.HTTPRoute{{
Match: []v1alpha3.HTTPMatchRequest{{
Authority: &v1alpha3.StringMatch{Exact: "test-route.test-ns.svc.cluster.local"},
}},
Route: []v1alpha3.DestinationWeight{{
Destination: v1alpha3.Destination{
Host: "v2-service.test-ns.svc.cluster.local",
Port: v1alpha3.PortSelector{Number: 80},
},
Weight: 100,
}},
Timeout: DefaultRouteTimeout,
AppendHeaders: map[string]string{
IstioTimeoutHackHeaderKey: IstioTimeoutHackHeaderValue,
},
}}
routes := MakeVirtualService(r, &traffic.TrafficConfig{Targets: targets}).Spec.Http
if diff := cmp.Diff(expected, routes); diff != "" {
fmt.Printf("%+v\n", routes)
fmt.Printf("%+v\n", expected)
t.Errorf("Unexpected routes (-want +got): %v", diff)
}
}

func TestGetRouteDomains_NamelessTarget(t *testing.T) {
r := &v1alpha1.Route{
ObjectMeta: metav1.ObjectMeta{
Expand Down

0 comments on commit 68d9d9a

Please sign in to comment.