dneuman64 closed pull request #3066: Fix ordering of DS matchlists to match the 
Perl
URL: https://github.com/apache/trafficcontrol/pull/3066
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go 
b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
index c6be2d15e..1ef12b705 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13.go
@@ -752,6 +752,7 @@ JOIN deliveryservice_regex as dsr ON dsr.regex = r.id
 JOIN deliveryservice as ds on ds.id = dsr.deliveryservice
 JOIN type as t ON r.type = t.id
 WHERE ds.xml_id = ANY($1)
+ORDER BY dsr.set_number
 `
        rows, err := tx.Query(q, pq.Array(dses))
        if err != nil {
diff --git 
a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13_test.go 
b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13_test.go
index f3d495ea4..83942653c 100644
--- a/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13_test.go
+++ b/traffic_ops/traffic_ops_golang/deliveryservice/deliveryservicesv13_test.go
@@ -25,8 +25,31 @@ import (
 
        "github.com/apache/trafficcontrol/lib/go-tc"
        "github.com/apache/trafficcontrol/lib/go-util"
+
+       "github.com/jmoiron/sqlx"
+       "gopkg.in/DATA-DOG/go-sqlmock.v1"
 )
 
+func TestGetDeliveryServicesMatchLists(t *testing.T) {
+       // test to make sure that the DS matchlists query orders by set_number
+       mockDB, mock, err := sqlmock.New()
+       if err != nil {
+               t.Fatalf("an error '%s' was not expected when opening a stub 
database connection", err)
+       }
+       defer mockDB.Close()
+
+       db := sqlx.NewDb(mockDB, "sqlmock")
+       defer db.Close()
+
+       mock.ExpectBegin()
+       mock.ExpectQuery("SELECT .+ ORDER BY dsr.set_number")
+
+       GetDeliveryServicesMatchLists([]string{"foo"}, db.MustBegin().Tx)
+       if err := mock.ExpectationsWereMet(); err != nil {
+               t.Errorf("expectations were not met: %s", err)
+       }
+}
+
 func TestMakeExampleURLs(t *testing.T) {
        expected := []string{
                `http://routing-name.ds-name.domain-name.invalid`,


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to