You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2018/07/24 16:53:42 UTC

[trafficcontrol] 01/04: Fixes #2575

This is an automated email from the ASF dual-hosted git repository.

dangogh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git

commit 41a19ac7565a8183c312c8be3785673fda825b66
Author: Dewayne Richardson <de...@apache.org>
AuthorDate: Mon Jul 23 14:04:25 2018 -0600

    Fixes #2575
---
 traffic_ops/testing/api/v13/staticdnsentries_test.go          |  6 +++---
 .../traffic_ops_golang/staticdnsentry/staticdnsentry.go       | 11 ++++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/traffic_ops/testing/api/v13/staticdnsentries_test.go b/traffic_ops/testing/api/v13/staticdnsentries_test.go
index 3dc8a6a..ca21937 100644
--- a/traffic_ops/testing/api/v13/staticdnsentries_test.go
+++ b/traffic_ops/testing/api/v13/staticdnsentries_test.go
@@ -37,8 +37,8 @@ func TestStaticDNSEntries(t *testing.T) {
 	CreateTestStaticDNSEntries(t)
 	GetTestStaticDNSEntries(t)
 	UpdateTestStaticDNSEntries(t)
-	DeleteTestDeliveryServices(t)
 	DeleteTestStaticDNSEntries(t)
+	DeleteTestDeliveryServices(t)
 	DeleteTestServers(t)
 	DeleteTestCacheGroups(t)
 	DeleteTestPhysLocations(t)
@@ -140,10 +140,10 @@ func DeleteTestStaticDNSEntries(t *testing.T) {
 
 			_, _, err := TOSession.DeleteStaticDNSEntryByID(respStaticDNSEntry.ID)
 			if err != nil {
-				t.Errorf("cannot DELETE StaticDNSEntrie by name: '%s' %v\n", respStaticDNSEntry.Host, err)
+				t.Errorf("cannot DELETE StaticDNSEntry by name: '%s' %v\n", respStaticDNSEntry.Host, err)
 			}
 
-			// Retrieve the StaticDNSEntrie to see if it got deleted
+			// Retrieve the StaticDNSEntry to see if it got deleted
 			staticDNSEntries, _, err := TOSession.GetStaticDNSEntriesByHost(staticDNSEntry.Host)
 			if err != nil {
 				t.Errorf("error deleting StaticDNSEntrie name: %s\n", err.Error())
diff --git a/traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go b/traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go
index 5f213b0..0e162b2 100644
--- a/traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go
+++ b/traffic_ops/traffic_ops_golang/staticdnsentry/staticdnsentry.go
@@ -92,7 +92,16 @@ func (staticDNSEntry TOStaticDNSEntry) Validate() error {
 
 func (staticDNSEntry *TOStaticDNSEntry) Read(parameters map[string]string) ([]interface{}, []error, tc.ApiErrorType) {
 	queryParamsToQueryCols := map[string]dbhelpers.WhereColumnInfo{
-		"deliveryservice": dbhelpers.WhereColumnInfo{"deliveryservice", nil}, // order by
+		"address":           dbhelpers.WhereColumnInfo{"sde.address", nil},
+		"cachegroup":        dbhelpers.WhereColumnInfo{"cg.name", nil},
+		"cachegroupId":      dbhelpers.WhereColumnInfo{"cg.id", nil},
+		"deliveryservice":   dbhelpers.WhereColumnInfo{"ds.xml_id", nil},
+		"deliveryserviceId": dbhelpers.WhereColumnInfo{"sde.deliveryservice", nil},
+		"host":              dbhelpers.WhereColumnInfo{"sde.host", nil},
+		"id":                dbhelpers.WhereColumnInfo{"sde.id", nil},
+		"ttl":               dbhelpers.WhereColumnInfo{"sde.ttl", nil},
+		"type":              dbhelpers.WhereColumnInfo{"tp.name", nil},
+		"typeId":            dbhelpers.WhereColumnInfo{"tp.id", nil},
 	}
 	where, orderBy, queryValues, errs := dbhelpers.BuildWhereAndOrderBy(parameters, queryParamsToQueryCols)
 	if len(errs) > 0 {