From commits-return-6985-archive-asf-public=cust-asf.ponee.io@trafficcontrol.apache.org Fri Nov 2 16:06:13 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3ADBA18077A for ; Fri, 2 Nov 2018 16:06:12 +0100 (CET) Received: (qmail 79224 invoked by uid 500); 2 Nov 2018 15:06:11 -0000 Mailing-List: contact commits-help@trafficcontrol.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@trafficcontrol.apache.org Delivered-To: mailing list commits@trafficcontrol.apache.org Received: (qmail 79079 invoked by uid 99); 2 Nov 2018 15:06:11 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Nov 2018 15:06:11 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 17C4687117; Fri, 2 Nov 2018 15:06:10 +0000 (UTC) Date: Fri, 02 Nov 2018 15:06:17 +0000 To: "commits@trafficcontrol.apache.org" Subject: [trafficcontrol] 08/09: eliminate profileParameters test -- includeed in profiles MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: rawlin@apache.org In-Reply-To: <154117116957.24280.5893318093386678610@gitbox.apache.org> References: <154117116957.24280.5893318093386678610@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: trafficcontrol X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: cdd748b5ab5591ccac408f1519e858fa1446f90e X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20181102150610.17C4687117@gitbox.apache.org> 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 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¶meterId=%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"`