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/03/08 22:31:40 UTC
[incubator-trafficcontrol] 26/28: parallel delete to point out
delete bug
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/incubator-trafficcontrol.git
commit 06a586550b49a8104b2723f036787d6de2a1692c
Author: Dewayne Richardson <de...@apache.org>
AuthorDate: Tue Mar 6 14:40:40 2018 -0700
parallel delete to point out delete bug
---
traffic_ops/testing/api/v13/parameters_test.go | 62 ++++++++++++++++++--------
1 file changed, 43 insertions(+), 19 deletions(-)
diff --git a/traffic_ops/testing/api/v13/parameters_test.go b/traffic_ops/testing/api/v13/parameters_test.go
index 21d7ece..84a23a1 100644
--- a/traffic_ops/testing/api/v13/parameters_test.go
+++ b/traffic_ops/testing/api/v13/parameters_test.go
@@ -16,6 +16,7 @@
package v13
import (
+ "sync"
"testing"
"github.com/apache/incubator-trafficcontrol/lib/go-log"
@@ -24,6 +25,9 @@ import (
func TestParameters(t *testing.T) {
+ //toReqTimeout := time.Second * time.Duration(Config.Default.Session.TimeoutInSecs)
+ //SwitchSession(toReqTimeout, Config.TrafficOps.URL, Config.TrafficOps.Users.Admin, Config.TrafficOps.UserPassword, Config.TrafficOps.Users.Portal, Config.TrafficOps.UserPassword)
+
CreateTestParameters(t)
UpdateTestParameters(t)
GetTestParameters(t)
@@ -82,30 +86,50 @@ func GetTestParameters(t *testing.T) {
}
}
+func DeleteTestParametersParallel(t *testing.T) {
+
+ var wg sync.WaitGroup
+ for _, pl := range testData.Parameters {
+
+ wg.Add(1)
+ go func() {
+ defer wg.Done()
+ DeleteTestParameter(t, pl)
+ }()
+
+ }
+ wg.Wait()
+}
+
func DeleteTestParameters(t *testing.T) {
for _, pl := range testData.Parameters {
- // Retrieve the Parameter by name so we can get the id for the Update
- resp, _, err := TOSession.GetParameterByNameAndConfigFile(pl.Name, pl.ConfigFile)
+ DeleteTestParameter(t, pl)
+ }
+}
+
+func DeleteTestParameter(t *testing.T, pl tc.Parameter) {
+
+ // Retrieve the Parameter by name so we can get the id for the Update
+ resp, _, err := TOSession.GetParameterByNameAndConfigFile(pl.Name, pl.ConfigFile)
+ if err != nil {
+ t.Errorf("cannot GET Parameter by name: %v - %v\n", pl.Name, err)
+ }
+ if len(resp) > 0 {
+ respParameter := resp[0]
+
+ delResp, _, err := TOSession.DeleteParameterByID(respParameter.ID)
+ if err != nil {
+ t.Errorf("cannot DELETE Parameter by name: %v - %v\n", err, delResp)
+ }
+
+ // Retrieve the Parameter to see if it got deleted
+ pls, _, err := TOSession.GetParameterByNameAndConfigFile(pl.Name, pl.ConfigFile)
if err != nil {
- t.Errorf("cannot GET Parameter by name: %v - %v\n", pl.Name, err)
+ t.Errorf("error deleting Parameter name: %s\n", err.Error())
}
- if len(resp) > 0 {
- respParameter := resp[0]
-
- delResp, _, err := TOSession.DeleteParameterByID(respParameter.ID)
- if err != nil {
- t.Errorf("cannot DELETE Parameter by name: %v - %v\n", err, delResp)
- }
-
- // Retrieve the Parameter to see if it got deleted
- pls, _, err := TOSession.GetParameterByNameAndConfigFile(pl.Name, pl.ConfigFile)
- if err != nil {
- t.Errorf("error deleting Parameter name: %s\n", err.Error())
- }
- if len(pls) > 0 {
- t.Errorf("expected Parameter Name: %s and ConfigFile: %s to be deleted\n", pl.Name, pl.ConfigFile)
- }
+ if len(pls) > 0 {
+ t.Errorf("expected Parameter Name: %s and ConfigFile: %s to be deleted\n", pl.Name, pl.ConfigFile)
}
}
}
--
To stop receiving notification emails like this one, please contact
dangogh@apache.org.