You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ra...@apache.org on 2018/11/02 15:06:17 UTC

[trafficcontrol] 08/09: eliminate profileParameters test -- includeed in profiles

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

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

commit cdd748b5ab5591ccac408f1519e858fa1446f90e
Author: Dan Kirkwood <da...@apache.org>
AuthorDate: Tue Oct 30 10:32:18 2018 -0600

    eliminate profileParameters test -- includeed in profiles
---
 .../testing/api/v14/profile_parameters_test.go     | 120 ---------------------
 traffic_ops/testing/api/v14/profiles_test.go       |   5 +-
 traffic_ops/testing/api/v14/tc-fixtures.json       |  44 ++++----
 traffic_ops/testing/api/v14/traffic_control.go     |   1 -
 4 files changed, 20 insertions(+), 150 deletions(-)

diff --git a/traffic_ops/testing/api/v14/profile_parameters_test.go b/traffic_ops/testing/api/v14/profile_parameters_test.go
deleted file mode 100644
index ea40b68..0000000
--- a/traffic_ops/testing/api/v14/profile_parameters_test.go
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
-
-package v14
-
-import (
-	"fmt"
-	"sync"
-	"testing"
-
-	"github.com/apache/trafficcontrol/lib/go-log"
-	"github.com/apache/trafficcontrol/lib/go-tc"
-)
-
-const queryParamFormat = "?profileId=%d&parameterId=%d"
-
-func TestProfileParameters(t *testing.T) {
-
-	CreateTestCDNs(t)
-	CreateTestTypes(t)
-	CreateTestParameters(t)
-	CreateTestProfiles(t)
-	CreateTestProfileParameters(t)
-	GetTestProfileParameters(t)
-	DeleteTestProfileParameters(t)
-	DeleteTestParameters(t)
-	DeleteTestProfiles(t)
-	DeleteTestTypes(t)
-	DeleteTestCDNs(t)
-
-}
-
-func CreateTestProfileParameters(t *testing.T) {
-
-	firstProfile := testData.Profiles[0]
-	firstParameter := testData.Parameters[0]
-
-	pp := tc.ProfileParameter{
-		Profile:   firstProfile.Name,
-		Parameter: firstParameter.Name,
-	}
-	resp, _, err := TOSession.CreateProfileParameter(pp)
-	log.Debugln("Response: ", resp)
-	if err != nil {
-		t.Errorf("could not CREATE profile parameters: %v\n", err)
-	}
-
-}
-
-func GetTestProfileParameters(t *testing.T) {
-
-	for _, pp := range testData.ProfileParameters {
-		queryParams := fmt.Sprintf(queryParamFormat, pp.ProfileID, pp.ParameterID)
-		resp, _, err := TOSession.GetProfileParameterByQueryParams(queryParams)
-		if err != nil {
-			t.Errorf("cannot GET Parameter by name: %v - %v\n", err, resp)
-		}
-	}
-}
-
-func DeleteTestProfileParametersParallel(t *testing.T) {
-
-	var wg sync.WaitGroup
-	for _, pp := range testData.ProfileParameters {
-
-		wg.Add(1)
-		go func() {
-			defer wg.Done()
-			DeleteTestProfileParameter(t, pp)
-		}()
-
-	}
-	wg.Wait()
-}
-
-func DeleteTestProfileParameters(t *testing.T) {
-
-	for _, pp := range testData.ProfileParameters {
-		DeleteTestProfileParameter(t, pp)
-	}
-}
-
-func DeleteTestProfileParameter(t *testing.T, pp tc.ProfileParameter) {
-
-	queryParams := fmt.Sprintf(queryParamFormat, pp.ProfileID, pp.ParameterID)
-	// Retrieve the PtofileParameter by profile so we can get the id for the Update
-	resp, _, err := TOSession.GetProfileParameterByQueryParams(queryParams)
-	if err != nil {
-		t.Errorf("cannot GET Parameter by profile: %v - %v\n", pp.Profile, err)
-	}
-	if len(resp) > 0 {
-		respPP := resp[0]
-
-		delResp, _, err := TOSession.DeleteParameterByProfileParameter(respPP.ProfileID, respPP.ParameterID)
-		if err != nil {
-			t.Errorf("cannot DELETE Parameter by profile: %v - %v\n", err, delResp)
-		}
-
-		// Retrieve the Parameter to see if it got deleted
-		pps, _, err := TOSession.GetProfileParameterByQueryParams(queryParams)
-		if err != nil {
-			t.Errorf("error deleting Parameter name: %s\n", err.Error())
-		}
-		if len(pps) > 0 {
-			t.Errorf("expected Parameter Name: %s and ConfigFile: %s to be deleted\n", pp.Profile, pp.Parameter)
-		}
-	}
-}
diff --git a/traffic_ops/testing/api/v14/profiles_test.go b/traffic_ops/testing/api/v14/profiles_test.go
index b5506f3..f8e25fa 100644
--- a/traffic_ops/testing/api/v14/profiles_test.go
+++ b/traffic_ops/testing/api/v14/profiles_test.go
@@ -30,13 +30,9 @@ func TestProfiles(t *testing.T) {
 	// attempt to create profiles with missing info
 	CreateBadProfiles(t)
 	CreateTestProfiles(t)
-	CreateTestParameters(t)
-	CreateTestProfileParameters(t)
 	UpdateTestProfiles(t)
 	GetTestProfiles(t)
 	GetTestProfilesWithParameters(t)
-	DeleteTestProfileParameters(t)
-	DeleteTestParameters(t)
 	DeleteTestProfiles(t)
 	DeleteTestTypes(t)
 	DeleteTestCDNs(t)
@@ -125,6 +121,7 @@ func GetTestProfiles(t *testing.T) {
 		}
 	}
 }
+
 func GetTestProfilesWithParameters(t *testing.T) {
 	firstProfile := testData.Profiles[0]
 	resp, _, err := TOSession.GetProfileByName(firstProfile.Name)
diff --git a/traffic_ops/testing/api/v14/tc-fixtures.json b/traffic_ops/testing/api/v14/tc-fixtures.json
index 8292694..8a1389f 100644
--- a/traffic_ops/testing/api/v14/tc-fixtures.json
+++ b/traffic_ops/testing/api/v14/tc-fixtures.json
@@ -352,7 +352,7 @@
         {
             "name": "origin1",
             "cachegroup": "originCachegroup",
-            "deliveryService": "test-ds1",
+            "deliveryService": "ds1",
             "fqdn": "origin1.example.com",
             "ipAddress": "1.2.3.4",
             "ip6Address": "dead:beef:cafe::42",
@@ -363,7 +363,7 @@
         {
             "name": "origin2",
             "cachegroup": "originCachegroup",
-            "deliveryService": "test-ds2",
+            "deliveryService": "ds2",
             "fqdn": "origin2.example.com",
             "ipAddress": "5.6.7.8",
             "ip6Address": "cafe::42",
@@ -395,20 +395,6 @@
             "value": "30"
         },
         {
-            "configFile": "url_sig.config",
-            "lastUpdated": "2018-01-19T19:01:21.431062+00:00",
-            "name": "error_url",
-            "secure": true,
-            "value": "403"
-        },
-        {
-            "configFile": "records.config",
-            "lastUpdated": "2018-01-19T19:01:21.432692+00:00",
-            "name": "CONFIG proxy.config.allocator.debug_filter",
-            "secure": false,
-            "value": "INT 0"
-        },
-        {
             "configFile": "records.config",
             "lastUpdated": "2018-01-19T19:01:21.434425+00:00",
             "name": "CONFIG proxy.config.allocator.enable_reclaim",
@@ -572,7 +558,23 @@
             "lastUpdated": "2018-03-02T17:27:11.796899+00:00",
             "name": "EDGE1",
             "routing_disabled": true,
-            "type": "ATS_PROFILE"
+            "type": "ATS_PROFILE",
+            "params": [
+                {
+                    "configFile": "url_sig.config",
+                    "lastUpdated": "2018-01-19T19:01:21.431062+00:00",
+                    "name": "error_url",
+                    "secure": true,
+                    "value": "403"
+                },
+                {
+                    "configFile": "records.config",
+                    "lastUpdated": "2018-01-19T19:01:21.432692+00:00",
+                    "name": "CONFIG proxy.config.allocator.debug_filter",
+                    "secure": false,
+                    "value": "INT 0"
+                }
+            ]
         },
         {
             "cdnName": "cdn4",
@@ -623,14 +625,6 @@
             "type": "TM_PROFILE"
         }
     ],
-    "profileParameters": [
-        {
-            "parameterId": 100
-        },
-        {
-            "parameterId": 200
-        }
-    ],
     "regions": [
         {
             "divisionName": "division1",
diff --git a/traffic_ops/testing/api/v14/traffic_control.go b/traffic_ops/testing/api/v14/traffic_control.go
index 200bfdc..5fd6ce5 100644
--- a/traffic_ops/testing/api/v14/traffic_control.go
+++ b/traffic_ops/testing/api/v14/traffic_control.go
@@ -33,7 +33,6 @@ type TrafficControl struct {
 	Origins                        []tc.Origin                        `json:"origins"`
 	Profiles                       []tc.Profile                       `json:"profiles"`
 	Parameters                     []tc.Parameter                     `json:"parameters"`
-	ProfileParameters              []tc.ProfileParameter              `json:"profileParameters"`
 	PhysLocations                  []tc.PhysLocation                  `json:"physLocations"`
 	Regions                        []tc.Region                        `json:"regions"`
 	Roles                          []tc.Role                          `json:"roles"`