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

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


The following commit(s) were added to refs/heads/master by this push:
     new f21adfd  Remove tests for non existent perl endpoints (#5594)
f21adfd is described below

commit f21adfd6e76d7d359ac174e2fe168b69aae2b1ba
Author: Srijeet Chatterjee <[email protected]>
AuthorDate: Tue Mar 2 10:20:01 2021 -0700

    Remove tests for non existent perl endpoints (#5594)
    
    * Remove tests for non existent perl endpoints
    
    * remove file
    
    * remove noPerl checks
    
    * remove noPerl from config
---
 .../to-integration-tests/traffic-ops-test.json     |   1 -
 traffic_ops/testing/api/conf/traffic-ops-test.conf |   1 -
 traffic_ops/testing/api/config/config.go           |   2 -
 .../testing/api/v1/federation_users_test.go        |   3 -
 traffic_ops/testing/api/v1/federations_test.go     |   3 -
 .../testing/api/v1/userdeliveryservices_test.go    | 198 ---------------------
 traffic_ops/testing/api/v1/withobjs_test.go        |   1 -
 7 files changed, 209 deletions(-)

diff --git a/.github/actions/to-integration-tests/traffic-ops-test.json 
b/.github/actions/to-integration-tests/traffic-ops-test.json
index 1c7298e..645c62a 100644
--- a/.github/actions/to-integration-tests/traffic-ops-test.json
+++ b/.github/actions/to-integration-tests/traffic-ops-test.json
@@ -34,6 +34,5 @@
                "type": "Pg",
                "user": "traffic_ops"
        },
-       "noPerl": true,
        "noISO": true
 }
diff --git a/traffic_ops/testing/api/conf/traffic-ops-test.conf 
b/traffic_ops/testing/api/conf/traffic-ops-test.conf
index 38dfbbe..4dd446a 100644
--- a/traffic_ops/testing/api/conf/traffic-ops-test.conf
+++ b/traffic_ops/testing/api/conf/traffic-ops-test.conf
@@ -35,6 +35,5 @@
         "type": "Pg",
         "user": "traffic_ops"
     },
-    "noPerl": false,
     "noISO": false
 }
diff --git a/traffic_ops/testing/api/config/config.go 
b/traffic_ops/testing/api/config/config.go
index 94fd796..a439a50 100644
--- a/traffic_ops/testing/api/config/config.go
+++ b/traffic_ops/testing/api/config/config.go
@@ -38,8 +38,6 @@ type Config struct {
        TrafficOpsDB TrafficOpsDB `json:"trafficOpsDB"`
        Default      Default      `json:"default"`
        UseIMS       bool         `json:"use_ims"`
-       // Sets whether or not to perform tests that must proxy to Perl
-       NoPerl bool `json:"noPerl"`
        // Sets whether or not to perform tests that involve ISO generation
        NoISO bool `json:"noISO"`
 }
diff --git a/traffic_ops/testing/api/v1/federation_users_test.go 
b/traffic_ops/testing/api/v1/federation_users_test.go
index bb2e66a..c5527a4 100644
--- a/traffic_ops/testing/api/v1/federation_users_test.go
+++ b/traffic_ops/testing/api/v1/federation_users_test.go
@@ -20,9 +20,6 @@ import (
 )
 
 func TestFederationUsers(t *testing.T) {
-       if Config.NoPerl {
-               t.Skip("No Perl instance for proxying")
-       }
        WithObjs(t, []TCObj{CDNs, Types, Tenants, Users, Parameters, Profiles, 
Statuses, Divisions, Regions, PhysLocations, CacheGroups, DeliveryServices, 
CDNFederations, FederationUsers}, func() {
                CreateTestInvalidFederationUsers(t)
                GetTestInvalidFederationIDUsers(t)
diff --git a/traffic_ops/testing/api/v1/federations_test.go 
b/traffic_ops/testing/api/v1/federations_test.go
index b30822e..087058e 100644
--- a/traffic_ops/testing/api/v1/federations_test.go
+++ b/traffic_ops/testing/api/v1/federations_test.go
@@ -24,9 +24,6 @@ import (
 )
 
 func TestFederations(t *testing.T) {
-       if Config.NoPerl {
-               t.Skip("No Perl instance for proxying")
-       }
        WithObjs(t, []TCObj{CDNs, Types, Tenants, Parameters, Profiles, 
Statuses, Divisions, Regions, PhysLocations, CacheGroups, DeliveryServices, 
CDNFederations}, func() {
                PostDeleteTestFederationsDeliveryServices(t)
                GetTestFederations(t)
diff --git a/traffic_ops/testing/api/v1/userdeliveryservices_test.go 
b/traffic_ops/testing/api/v1/userdeliveryservices_test.go
deleted file mode 100644
index d78a512..0000000
--- a/traffic_ops/testing/api/v1/userdeliveryservices_test.go
+++ /dev/null
@@ -1,198 +0,0 @@
-package v1
-
-/*
-
-   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.
-*/
-
-import (
-       "testing"
-)
-
-func TestUserDeliveryServices(t *testing.T) {
-       if Config.NoPerl {
-               t.Skip("No Perl instance for proxying")
-       }
-       WithObjs(t, []TCObj{CDNs, Types, Tenants, Parameters, Profiles, 
Statuses, Divisions, Regions, PhysLocations, CacheGroups, DeliveryServices, 
UsersDeliveryServices}, func() {
-               GetTestUsersDeliveryServices(t)
-       })
-}
-
-const TestUsersDeliveryServicesUser = "admin" // TODO make dynamic
-
-func CreateTestUsersDeliveryServices(t *testing.T) {
-       dses, _, err := TOSession.GetDeliveryServices()
-       if err != nil {
-               t.Errorf("cannot GET DeliveryServices: %v - %v", err, dses)
-       }
-       if len(dses) == 0 {
-               t.Error("no delivery services, must have at least 1 ds to test 
users_deliveryservices")
-       }
-       users, _, err := TOSession.GetUsers()
-       if err != nil {
-               t.Errorf("cannot GET users: %v", err)
-       }
-       if len(users) == 0 {
-               t.Error("no users, must have at least 1 user to test 
users_deliveryservices")
-       }
-
-       dsIDs := []int{}
-       for _, ds := range dses {
-               dsIDs = append(dsIDs, ds.ID)
-       }
-
-       userID := 0
-       foundUser := false
-       for _, user := range users {
-               if *user.Username == TestUsersDeliveryServicesUser {
-                       userID = *user.ID
-                       foundUser = true
-                       break
-               }
-       }
-       if !foundUser {
-               t.Errorf("get users expected: %v actual: missing", 
TestUsersDeliveryServicesUser)
-       }
-
-       _, err = TOSession.SetDeliveryServiceUser(userID, dsIDs, true)
-       if err != nil {
-               t.Errorf("failed to set delivery service users: " + err.Error())
-       }
-
-       userDSes, _, err := TOSession.GetUserDeliveryServices(userID)
-       if err != nil {
-               t.Errorf("get user delivery services returned error: " + 
err.Error())
-       }
-
-       if len(userDSes.Response) != len(dsIDs) {
-               t.Errorf("get user delivery services expected %v actual %v", 
len(dsIDs), len(userDSes.Response))
-       }
-
-       actualDSIDMap := map[int]struct{}{}
-       for _, userDS := range userDSes.Response {
-               if userDS.ID == nil {
-                       t.Error("get user delivery services returned a DS with 
a nil ID")
-               }
-               actualDSIDMap[*userDS.ID] = struct{}{}
-       }
-       for _, dsID := range dsIDs {
-               if _, ok := actualDSIDMap[dsID]; !ok {
-                       t.Errorf("get user delivery services expected %v actual 
%v", dsID, "missing")
-               }
-       }
-}
-
-func GetTestUsersDeliveryServices(t *testing.T) {
-       dses, _, err := TOSession.GetDeliveryServices()
-       if err != nil {
-               t.Errorf("cannot GET DeliveryServices: %v - %v", err, dses)
-       }
-       if len(dses) == 0 {
-               t.Error("no delivery services, must have at least 1 ds to test 
users_deliveryservices")
-       }
-       users, _, err := TOSession.GetUsers()
-       if err != nil {
-               t.Errorf("cannot GET users: %v", err)
-       }
-       if len(users) == 0 {
-               t.Error("no users, must have at least 1 user to test 
users_deliveryservices")
-       }
-
-       dsIDs := []int64{}
-       for _, ds := range dses {
-               dsIDs = append(dsIDs, int64(ds.ID))
-       }
-
-       userID := 0
-       foundUser := false
-       for _, user := range users {
-               if *user.Username == TestUsersDeliveryServicesUser {
-                       userID = *user.ID
-                       foundUser = true
-                       break
-               }
-       }
-       if !foundUser {
-               t.Errorf("get users expected: %v actual: missing", 
TestUsersDeliveryServicesUser)
-       }
-
-       userDSes, _, err := TOSession.GetUserDeliveryServices(userID)
-       if err != nil {
-               t.Errorf("get user delivery services returned error: " + 
err.Error() + "\n")
-       }
-
-       if len(userDSes.Response) != len(dsIDs) {
-               t.Errorf("get user delivery services expected %v actual %v", 
len(dsIDs), len(userDSes.Response))
-       }
-
-       actualDSIDMap := map[int]struct{}{}
-       for _, userDS := range userDSes.Response {
-               if userDS.ID == nil {
-                       t.Error("get user delivery services returned a DS with 
a nil ID")
-               }
-               actualDSIDMap[*userDS.ID] = struct{}{}
-       }
-       for _, dsID := range dsIDs {
-               if _, ok := actualDSIDMap[int(dsID)]; !ok {
-                       t.Errorf("get user delivery services expected %v actual 
%v", dsID, "missing")
-               }
-       }
-}
-
-func DeleteTestUsersDeliveryServices(t *testing.T) {
-       users, _, err := TOSession.GetUsers()
-       if err != nil {
-               t.Errorf("cannot GET users: %v", err)
-       }
-       if len(users) == 0 {
-               t.Error("no users, must have at least 1 user to test 
users_deliveryservices")
-       }
-       userID := 0
-       foundUser := false
-       for _, user := range users {
-               if *user.Username == TestUsersDeliveryServicesUser {
-                       userID = *user.ID
-                       foundUser = true
-                       break
-               }
-       }
-       if !foundUser {
-               t.Errorf("get users expected: %v actual: missing", 
TestUsersDeliveryServicesUser)
-       }
-
-       dses, _, err := TOSession.GetUserDeliveryServices(userID)
-       if err != nil {
-               t.Errorf("get user delivery services returned error: " + 
err.Error())
-       }
-       if len(dses.Response) == 0 {
-               t.Errorf("get user delivery services expected %v actual %v", 
">0", "0")
-       }
-
-       for _, ds := range dses.Response {
-               if ds.ID == nil {
-                       t.Error("get user delivery services returned ds with 
nil ID")
-               }
-               _, err := TOSession.DeleteDeliveryServiceUser(userID, *ds.ID)
-               if err != nil {
-                       t.Errorf("delete user delivery service returned error: 
" + err.Error())
-               }
-       }
-
-       dses, _, err = TOSession.GetUserDeliveryServices(userID)
-       if err != nil {
-               t.Errorf("get user delivery services returned error: " + 
err.Error())
-       }
-       if len(dses.Response) != 0 {
-               t.Errorf("get user delivery services after deleting expected %v 
actual %v", "0", len(dses.Response))
-       }
-}
diff --git a/traffic_ops/testing/api/v1/withobjs_test.go 
b/traffic_ops/testing/api/v1/withobjs_test.go
index 1697788..3084015 100644
--- a/traffic_ops/testing/api/v1/withobjs_test.go
+++ b/traffic_ops/testing/api/v1/withobjs_test.go
@@ -116,5 +116,4 @@ var withFuncs = map[TCObj]TCObjFuncs{
        TOExtensions:                         {CreateTestTOExtensions, 
DeleteTestTOExtensions},
        Types:                                {CreateTestTypes, 
DeleteTestTypes},
        Users:                                {CreateTestUsers, 
ForceDeleteTestUsers},
-       UsersDeliveryServices:                {CreateTestUsersDeliveryServices, 
DeleteTestUsersDeliveryServices},
 }

Reply via email to