You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by ro...@apache.org on 2021/05/10 22:44:53 UTC

[trafficcontrol] branch master updated: This fixes a bug in t3c that sets the queue update flag to true (#5824)

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

rob 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 39ff1ad  This fixes a bug in t3c that sets the queue update flag to true (#5824)
39ff1ad is described below

commit 39ff1ada3180c7f2ab256d39865e4a41b74d988b
Author: John J. Rushford <jr...@apache.org>
AuthorDate: Mon May 10 16:44:39 2021 -0600

    This fixes a bug in t3c that sets the queue update flag to true (#5824)
    
    when resetting the revalidate flag following a revalidation update.
    
      - Fixed the bug
      - Added an ORT integration test to test the t3c logic when
        updating the queue and revalidate flags.
      - refactored the testing package and moved commonly used
        ORT test functions to t3c-testlibs.go
      - renamed some of the test functions to use more sensical names.
---
 traffic_ops_ort/t3c/torequest/torequest.go         |   6 +-
 traffic_ops_ort/testing/ort-tests/t3c-testlibs.go  | 156 +++++++++++++++++++++
 traffic_ops_ort/testing/ort-tests/t3c_mode_test.go |  83 +----------
 ...updater_test.go => t3c_update_to_flags_test.go} |  89 +++++-------
 traffic_ops_ort/testing/ort-tests/tc-fixtures.json |   7 +
 .../testing/ort-tests/to_requester_test.go         |  45 +-----
 .../testing/ort-tests/to_updater_test.go           |  52 ++-----
 7 files changed, 225 insertions(+), 213 deletions(-)

diff --git a/traffic_ops_ort/t3c/torequest/torequest.go b/traffic_ops_ort/t3c/torequest/torequest.go
index 67eb86c..f02c8fc 100644
--- a/traffic_ops_ort/t3c/torequest/torequest.go
+++ b/traffic_ops_ort/t3c/torequest/torequest.go
@@ -1539,7 +1539,11 @@ func (r *TrafficOpsReq) UpdateTrafficOps(syncdsUpdate *UpdateStatus) (bool, erro
 				_, err = r.atsTcExecCommand("send-update", 0, 0)
 			}
 		case config.Revalidate:
-			_, err = r.atsTcExecCommand("send-update", 1, 0)
+			if serverStatus.UpdatePending {
+				_, err = r.atsTcExecCommand("send-update", 1, 0)
+			} else {
+				_, err = r.atsTcExecCommand("send-update", 0, 0)
+			}
 		}
 		if err != nil {
 			return false, errors.New("Traffic Ops Update failed: " + err.Error())
diff --git a/traffic_ops_ort/testing/ort-tests/t3c-testlibs.go b/traffic_ops_ort/testing/ort-tests/t3c-testlibs.go
new file mode 100644
index 0000000..9ab507a
--- /dev/null
+++ b/traffic_ops_ort/testing/ort-tests/t3c-testlibs.go
@@ -0,0 +1,156 @@
+/*
+   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 orttest
+
+// ORT Integration test functions
+
+import (
+	"bytes"
+	"errors"
+	"os/exec"
+	"strconv"
+	"strings"
+)
+
+func runPluginVerifier(config_file string) error {
+	args := []string{
+		"--log-location-debug=test.log",
+		config_file,
+	}
+	cmd := exec.Command("/opt/ort/plugin_verifier", args...)
+	var out bytes.Buffer
+	var errOut bytes.Buffer
+	cmd.Stdout = &out
+	cmd.Stderr = &errOut
+	err := cmd.Run()
+	if err != nil {
+		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
+	}
+	return nil
+}
+
+func runTORequester(host string, data_req string) (string, error) {
+	args := []string{
+		"--traffic-ops-insecure=true",
+		"--login-dispersion=0",
+		"--traffic-ops-timeout-milliseconds=3000",
+		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
+		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
+		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
+		"--cache-host-name=" + host,
+		"--log-location-error=test.log",
+		"--log-location-info=test.log",
+		"--log-location-debug=test.log",
+		"--get-data=" + data_req,
+	}
+	cmd := exec.Command("/opt/ort/to_requester", args...)
+	var out bytes.Buffer
+	var errOut bytes.Buffer
+	cmd.Stdout = &out
+	cmd.Stderr = &errOut
+	err := cmd.Run()
+	if err != nil {
+		return "", errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
+	}
+
+	// capture the last line of JSON in the 'Stdout' buffer 'out'
+	output := strings.Split(strings.TrimSpace(strings.Replace(out.String(), "\r\n", "\n", -1)), "\n")
+	lastLine := output[len(output)-1]
+
+	return lastLine, nil
+}
+
+func runTOUpdater(host string, reval_status bool, update_status bool) error {
+	args := []string{
+		"--traffic-ops-insecure=true",
+		"--login-dispersion=0",
+		"--traffic-ops-timeout-milliseconds=3000",
+		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
+		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
+		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
+		"--cache-host-name=" + host,
+		"--log-location-error=test.log",
+		"--log-location-info=test.log",
+		"--log-location-debug=test.log",
+		"--set-reval-status=" + strconv.FormatBool(reval_status),
+		"--set-update-status=" + strconv.FormatBool(update_status),
+	}
+	cmd := exec.Command("/opt/ort/to_updater", args...)
+	var out bytes.Buffer
+	var errOut bytes.Buffer
+	cmd.Stdout = &out
+	cmd.Stderr = &errOut
+	err := cmd.Run()
+	if err != nil {
+		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
+	}
+
+	return nil
+}
+
+func runT3cUpdate(host string, run_mode string) error {
+	args := []string{
+		"--traffic-ops-insecure=true",
+		"--dispersion=0",
+		"--login-dispersion=0",
+		"--traffic-ops-timeout-milliseconds=3000",
+		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
+		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
+		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
+		"--cache-host-name=" + host,
+		"--log-location-error=test.log",
+		"--log-location-info=test.log",
+		"--log-location-debug=test.log",
+		"--run-mode=" + run_mode,
+	}
+	cmd := exec.Command("/opt/ort/t3c", args...)
+	var out bytes.Buffer
+	var errOut bytes.Buffer
+	cmd.Stdout = &out
+	cmd.Stderr = &errOut
+	err := cmd.Run()
+	if err != nil {
+		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
+	}
+	return nil
+}
+
+func setQueueUpdateStatus(host_name string, update string) error {
+	args := []string{
+		"--dir=/opt/trafficserver/etc/traffficserver",
+		"--traffic-ops-insecure",
+		"--traffic-ops-timeout-milliseconds=30000",
+		"--traffic-ops-disable-proxy=true",
+		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
+		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
+		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
+		"--cache-host-name=" + host_name,
+		"--log-location-error=stdout",
+		"--log-location-info=stdout",
+		"--log-location-warning=stdout",
+		"--set-queue-status=" + update,
+		"--set-reval-status=false",
+	}
+	cmd := exec.Command("/opt/ort/atstccfg", args...)
+	var out bytes.Buffer
+	var errOut bytes.Buffer
+	cmd.Stdout = &out
+	cmd.Stderr = &errOut
+	err := cmd.Run()
+	if err != nil {
+		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
+	}
+	return nil
+}
diff --git a/traffic_ops_ort/testing/ort-tests/t3c_mode_test.go b/traffic_ops_ort/testing/ort-tests/t3c_mode_test.go
index 9d5b140..438d1cb 100644
--- a/traffic_ops_ort/testing/ort-tests/t3c_mode_test.go
+++ b/traffic_ops_ort/testing/ort-tests/t3c_mode_test.go
@@ -15,13 +15,10 @@ package orttest
 */
 
 import (
-	"bytes"
-	"errors"
 	"fmt"
 	"github.com/apache/trafficcontrol/traffic_ops_ort/testing/ort-tests/tcdata"
 	"github.com/apache/trafficcontrol/traffic_ops_ort/testing/ort-tests/util"
 	"os"
-	"os/exec"
 	"testing"
 	"time"
 )
@@ -52,7 +49,7 @@ func TestT3cBadassAndSyncDs(t *testing.T) {
 		tcdata.DeliveryServices}, func() {
 
 		// run badass and check config files.
-		err := t3c_update("atlanta-edge-03", "badass")
+		err := runT3cUpdate("atlanta-edge-03", "badass")
 		if err != nil {
 			t.Fatalf("ERROR: t3c badass failed: %v\n", err)
 		}
@@ -79,11 +76,11 @@ func TestT3cBadassAndSyncDs(t *testing.T) {
 		time.Sleep(time.Second * 5)
 
 		fmt.Println("------------------------ Verify Plugin Configs ----------------")
-		err = verify_plugin_config("/opt/trafficserver/etc/trafficserver/remap.config")
+		err = runPluginVerifier("/opt/trafficserver/etc/trafficserver/remap.config")
 		if err != nil {
 			t.Errorf("Plugin verification failed for remap.config")
 		}
-		err = verify_plugin_config("/opt/trafficserver/etc/trafficserver/plugin.config")
+		err = runPluginVerifier("/opt/trafficserver/etc/trafficserver/plugin.config")
 		if err != nil {
 			t.Errorf("Plugin verification failed for plugin.config")
 		}
@@ -106,7 +103,7 @@ func TestT3cBadassAndSyncDs(t *testing.T) {
 		// remap.config is removed and atlanta-edge-03 should have
 		// queue updates enabled.  run t3c to verify a new remap.config
 		// is pulled down.
-		err = t3c_update("atlanta-edge-03", "syncds")
+		err = runT3cUpdate("atlanta-edge-03", "syncds")
 		if err != nil {
 			t.Fatalf("ERROR: t3c syncds failed: %v\n", err)
 		}
@@ -118,75 +115,3 @@ func TestT3cBadassAndSyncDs(t *testing.T) {
 	})
 	fmt.Println("------------- End of TestT3cBadassAndSyncDs ---------------")
 }
-
-func setQueueUpdateStatus(host_name string, update string) error {
-	args := []string{
-		"--dir=/opt/trafficserver/etc/traffficserver",
-		"--traffic-ops-insecure",
-		"--traffic-ops-timeout-milliseconds=30000",
-		"--traffic-ops-disable-proxy=true",
-		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
-		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
-		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
-		"--cache-host-name=" + host_name,
-		"--log-location-error=stdout",
-		"--log-location-info=stdout",
-		"--log-location-warning=stdout",
-		"--set-queue-status=" + update,
-		"--set-reval-status=false",
-	}
-	cmd := exec.Command("/opt/ort/atstccfg", args...)
-	var out bytes.Buffer
-	var errOut bytes.Buffer
-	cmd.Stdout = &out
-	cmd.Stderr = &errOut
-	err := cmd.Run()
-	if err != nil {
-		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
-	}
-	return nil
-}
-
-func verify_plugin_config(config_file string) error {
-	args := []string{
-		"--log-location-debug=test.log",
-		config_file,
-	}
-	cmd := exec.Command("/opt/ort/plugin_verifier", args...)
-	var out bytes.Buffer
-	var errOut bytes.Buffer
-	cmd.Stdout = &out
-	cmd.Stderr = &errOut
-	err := cmd.Run()
-	if err != nil {
-		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
-	}
-	return nil
-}
-
-func t3c_update(host string, run_mode string) error {
-	args := []string{
-		"--traffic-ops-insecure=true",
-		"--dispersion=0",
-		"--login-dispersion=0",
-		"--traffic-ops-timeout-milliseconds=3000",
-		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
-		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
-		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
-		"--cache-host-name=" + host,
-		"--log-location-error=test.log",
-		"--log-location-info=test.log",
-		"--log-location-debug=test.log",
-		"--run-mode=" + run_mode,
-	}
-	cmd := exec.Command("/opt/ort/t3c", args...)
-	var out bytes.Buffer
-	var errOut bytes.Buffer
-	cmd.Stdout = &out
-	cmd.Stderr = &errOut
-	err := cmd.Run()
-	if err != nil {
-		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
-	}
-	return nil
-}
diff --git a/traffic_ops_ort/testing/ort-tests/to_updater_test.go b/traffic_ops_ort/testing/ort-tests/t3c_update_to_flags_test.go
similarity index 56%
copy from traffic_ops_ort/testing/ort-tests/to_updater_test.go
copy to traffic_ops_ort/testing/ort-tests/t3c_update_to_flags_test.go
index b288fe3..8b69b24 100644
--- a/traffic_ops_ort/testing/ort-tests/to_updater_test.go
+++ b/traffic_ops_ort/testing/ort-tests/t3c_update_to_flags_test.go
@@ -15,19 +15,15 @@ package orttest
 */
 
 import (
-	"bytes"
 	"encoding/json"
-	"errors"
 	"fmt"
 	"github.com/apache/trafficcontrol/lib/go-tc"
 	"github.com/apache/trafficcontrol/traffic_ops_ort/testing/ort-tests/tcdata"
-	"os/exec"
-	"strconv"
 	"testing"
 )
 
-func TestTOUpdater(t *testing.T) {
-	fmt.Println("------------- Starting TestTOUpdater tests ---------------")
+func TestT3cTOUpdates(t *testing.T) {
+	fmt.Println("------------- Starting TestT3cTOUpdates tests ---------------")
 	tcd.WithObjs(t, []tcdata.TCObj{
 		tcdata.CDNs, tcdata.Types, tcdata.Tenants, tcdata.Parameters,
 		tcdata.Profiles, tcdata.ProfileParameters, tcdata.Statuses,
@@ -36,9 +32,9 @@ func TestTOUpdater(t *testing.T) {
 		tcdata.DeliveryServices}, func() {
 
 		// retrieve the current server status
-		output, err := ExecTORequester("atlanta-edge-03", "update-status")
+		output, err := runTORequester("atlanta-edge-03", "update-status")
 		if err != nil {
-			t.Fatalf("ERROR: to_requester Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_requester run failed: %v\n", err)
 		}
 		var serverStatus tc.ServerUpdateStatus
 		err = json.Unmarshal([]byte(output), &serverStatus)
@@ -56,75 +52,66 @@ func TestTOUpdater(t *testing.T) {
 		}
 
 		// change the server update status
-		err = ExecTOUpdater("atlanta-edge-03", false, true)
+		err = runTOUpdater("atlanta-edge-03", true, true)
 		if err != nil {
-			t.Fatalf("ERROR: to_updater Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_updater run failed: %v\n", err)
 		}
 		// verify the update status is now 'true'
-		output, err = ExecTORequester("atlanta-edge-03", "update-status")
+		output, err = runTORequester("atlanta-edge-03", "update-status")
 		if err != nil {
-			t.Fatalf("ERROR: to_requester Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_requester run failed: %v\n", err)
 		}
 		err = json.Unmarshal([]byte(output), &serverStatus)
 		if err != nil {
 			t.Fatalf("ERROR unmarshalling json output: " + err.Error())
 		}
-		if serverStatus.RevalPending != false {
-			t.Fatal("ERROR unexpected result, expected RevalPending is 'false'")
+		if serverStatus.RevalPending != true {
+			t.Fatal("ERROR unexpected result, expected RevalPending is 'true'")
 		}
 		if serverStatus.UpdatePending != true {
 			t.Fatal("ERROR unexpected result, expected UpdatePending is 'true'")
 		}
 
-		// now change the reval stat and put server update status back
-		err = ExecTOUpdater("atlanta-edge-03", true, false)
+		// run t3c syncds and verify only the queue update flag is reset to 'false'
+		err = runT3cUpdate("atlanta-edge-03", "syncds")
 		if err != nil {
-			t.Fatalf("ERROR: to_updater Exec failed: %v\n", err)
+			t.Fatalf("ERROR: t3c syncds failed: %v\n", err)
 		}
-		// verify the change
-		output, err = ExecTORequester("atlanta-edge-03", "update-status")
+		output, err = runTORequester("atlanta-edge-03", "update-status")
 		if err != nil {
-			t.Fatalf("ERROR: to_requester Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_requester run failed: %v\n", err)
 		}
 		err = json.Unmarshal([]byte(output), &serverStatus)
 		if err != nil {
 			t.Fatalf("ERROR unmarshalling json output: " + err.Error())
 		}
 		if serverStatus.RevalPending != true {
-			t.Fatal("ERROR unexpected result, expected RevalPending is 'false'")
+			t.Fatal("ERROR unexpected result, expected RevalPending is 'true'")
 		}
 		if serverStatus.UpdatePending != false {
-			t.Fatal("ERROR unexpected result, expected UpdatePending is 'true'")
+			t.Fatal("ERROR unexpected result, expected UpdatePending is 'false'")
 		}
 
+		// run t3c revalidate and verify only the queue update flag is still 'false'
+		// and that the revalidate flag is now 'false'
+		err = runT3cUpdate("atlanta-edge-03", "revalidate")
+		if err != nil {
+			t.Fatalf("ERROR: t3c syncds failed: %v\n", err)
+		}
+		output, err = runTORequester("atlanta-edge-03", "update-status")
+		if err != nil {
+			t.Fatalf("ERROR: to_requester run failed: %v\n", err)
+		}
+		err = json.Unmarshal([]byte(output), &serverStatus)
+		if err != nil {
+			t.Fatalf("ERROR unmarshalling json output: " + err.Error())
+		}
+		if serverStatus.RevalPending != false {
+			t.Fatal("ERROR unexpected result, expected RevalPending is 'false'")
+		}
+		if serverStatus.UpdatePending != false {
+			t.Fatal("ERROR unexpected result, expected UpdatePending is 'false'")
+		}
 	})
-	fmt.Println("------------- End of TestTOUpdater tests ---------------")
-}
-
-func ExecTOUpdater(host string, reval_status bool, update_status bool) error {
-	args := []string{
-		"--traffic-ops-insecure=true",
-		"--login-dispersion=0",
-		"--traffic-ops-timeout-milliseconds=3000",
-		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
-		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
-		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
-		"--cache-host-name=" + host,
-		"--log-location-error=test.log",
-		"--log-location-info=test.log",
-		"--log-location-debug=test.log",
-		"--set-reval-status=" + strconv.FormatBool(reval_status),
-		"--set-update-status=" + strconv.FormatBool(update_status),
-	}
-	cmd := exec.Command("/opt/ort/to_updater", args...)
-	var out bytes.Buffer
-	var errOut bytes.Buffer
-	cmd.Stdout = &out
-	cmd.Stderr = &errOut
-	err := cmd.Run()
-	if err != nil {
-		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
-	}
-
-	return nil
+	fmt.Println("------------- End of TestT3cTOUpdates tests ---------------")
 }
diff --git a/traffic_ops_ort/testing/ort-tests/tc-fixtures.json b/traffic_ops_ort/testing/ort-tests/tc-fixtures.json
index 2b13899..9fd2bc0 100644
--- a/traffic_ops_ort/testing/ort-tests/tc-fixtures.json
+++ b/traffic_ops_ort/testing/ort-tests/tc-fixtures.json
@@ -1338,6 +1338,13 @@
             "name": "tm.instance_name",
             "secure": false,
             "value": "Traffic Ops ORT Tests"
+        },
+        {
+            "configFile": "global",
+            "lastUpdated": "2020-04-21T05:19:43.853831+00:00",
+            "name": "use_reval_pending",
+            "secure": false,
+            "value": "1"
         }
     ],
     "physLocations": [
diff --git a/traffic_ops_ort/testing/ort-tests/to_requester_test.go b/traffic_ops_ort/testing/ort-tests/to_requester_test.go
index 0b3e8cf..3715583 100644
--- a/traffic_ops_ort/testing/ort-tests/to_requester_test.go
+++ b/traffic_ops_ort/testing/ort-tests/to_requester_test.go
@@ -15,14 +15,10 @@ package orttest
 */
 
 import (
-	"bytes"
 	"encoding/json"
-	"errors"
 	"fmt"
 	"github.com/apache/trafficcontrol/lib/go-tc"
 	"github.com/apache/trafficcontrol/traffic_ops_ort/testing/ort-tests/tcdata"
-	"os/exec"
-	"strings"
 	"testing"
 )
 
@@ -41,7 +37,7 @@ func TestTORequester(t *testing.T) {
 		tcdata.DeliveryServices}, func() {
 
 		// chkconfig test
-		output, err := ExecTORequester("atlanta-edge-03", "chkconfig")
+		output, err := runTORequester("atlanta-edge-03", "chkconfig")
 		if err != nil {
 			t.Fatalf("ERROR: to_requester exec failed: %v\n", err)
 		}
@@ -55,7 +51,7 @@ func TestTORequester(t *testing.T) {
 		}
 
 		// get system-info test
-		output, err = ExecTORequester("atlanta-edge-03", "system-info")
+		output, err = runTORequester("atlanta-edge-03", "system-info")
 		if err != nil {
 			t.Fatalf("ERROR: to_requester exec failed: %v\n", err)
 		}
@@ -69,7 +65,7 @@ func TestTORequester(t *testing.T) {
 		}
 
 		// statuses test
-		output, err = ExecTORequester("atlanta-edge-03", "statuses")
+		output, err = runTORequester("atlanta-edge-03", "statuses")
 		if err != nil {
 			t.Fatalf("ERROR: to_requester exec failed: %v\n", err)
 		}
@@ -81,7 +77,7 @@ func TestTORequester(t *testing.T) {
 		}
 
 		// packages test
-		output, err = ExecTORequester("atlanta-edge-03", "packages")
+		output, err = runTORequester("atlanta-edge-03", "packages")
 		if err != nil {
 			t.Fatalf("ERROR: to_requester exec failed: %v\n", err)
 		}
@@ -96,7 +92,7 @@ func TestTORequester(t *testing.T) {
 		}
 
 		// update-status test
-		output, err = ExecTORequester("atlanta-edge-03", "update-status")
+		output, err = runTORequester("atlanta-edge-03", "update-status")
 		if err != nil {
 			t.Fatalf("ERROR: to_requester exec failed: %v\n", err)
 		}
@@ -112,34 +108,3 @@ func TestTORequester(t *testing.T) {
 	})
 	fmt.Println("------------- End of TestTORequester tests ---------------")
 }
-
-func ExecTORequester(host string, data_req string) (string, error) {
-	args := []string{
-		"--traffic-ops-insecure=true",
-		"--login-dispersion=0",
-		"--traffic-ops-timeout-milliseconds=3000",
-		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
-		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
-		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
-		"--cache-host-name=" + host,
-		"--log-location-error=test.log",
-		"--log-location-info=test.log",
-		"--log-location-debug=test.log",
-		"--get-data=" + data_req,
-	}
-	cmd := exec.Command("/opt/ort/to_requester", args...)
-	var out bytes.Buffer
-	var errOut bytes.Buffer
-	cmd.Stdout = &out
-	cmd.Stderr = &errOut
-	err := cmd.Run()
-	if err != nil {
-		return "", errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
-	}
-
-	// capture the last line of JSON in the 'Stdout' buffer 'out'
-	output := strings.Split(strings.TrimSpace(strings.Replace(out.String(), "\r\n", "\n", -1)), "\n")
-	lastLine := output[len(output)-1]
-
-	return lastLine, nil
-}
diff --git a/traffic_ops_ort/testing/ort-tests/to_updater_test.go b/traffic_ops_ort/testing/ort-tests/to_updater_test.go
index b288fe3..53e51f9 100644
--- a/traffic_ops_ort/testing/ort-tests/to_updater_test.go
+++ b/traffic_ops_ort/testing/ort-tests/to_updater_test.go
@@ -15,14 +15,10 @@ package orttest
 */
 
 import (
-	"bytes"
 	"encoding/json"
-	"errors"
 	"fmt"
 	"github.com/apache/trafficcontrol/lib/go-tc"
 	"github.com/apache/trafficcontrol/traffic_ops_ort/testing/ort-tests/tcdata"
-	"os/exec"
-	"strconv"
 	"testing"
 )
 
@@ -36,9 +32,9 @@ func TestTOUpdater(t *testing.T) {
 		tcdata.DeliveryServices}, func() {
 
 		// retrieve the current server status
-		output, err := ExecTORequester("atlanta-edge-03", "update-status")
+		output, err := runTORequester("atlanta-edge-03", "update-status")
 		if err != nil {
-			t.Fatalf("ERROR: to_requester Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_requester run failed: %v\n", err)
 		}
 		var serverStatus tc.ServerUpdateStatus
 		err = json.Unmarshal([]byte(output), &serverStatus)
@@ -56,14 +52,14 @@ func TestTOUpdater(t *testing.T) {
 		}
 
 		// change the server update status
-		err = ExecTOUpdater("atlanta-edge-03", false, true)
+		err = runTOUpdater("atlanta-edge-03", false, true)
 		if err != nil {
-			t.Fatalf("ERROR: to_updater Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_updater run failed: %v\n", err)
 		}
 		// verify the update status is now 'true'
-		output, err = ExecTORequester("atlanta-edge-03", "update-status")
+		output, err = runTORequester("atlanta-edge-03", "update-status")
 		if err != nil {
-			t.Fatalf("ERROR: to_requester Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_requester run failed: %v\n", err)
 		}
 		err = json.Unmarshal([]byte(output), &serverStatus)
 		if err != nil {
@@ -77,14 +73,14 @@ func TestTOUpdater(t *testing.T) {
 		}
 
 		// now change the reval stat and put server update status back
-		err = ExecTOUpdater("atlanta-edge-03", true, false)
+		err = runTOUpdater("atlanta-edge-03", true, false)
 		if err != nil {
-			t.Fatalf("ERROR: to_updater Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_updater run failed: %v\n", err)
 		}
 		// verify the change
-		output, err = ExecTORequester("atlanta-edge-03", "update-status")
+		output, err = runTORequester("atlanta-edge-03", "update-status")
 		if err != nil {
-			t.Fatalf("ERROR: to_requester Exec failed: %v\n", err)
+			t.Fatalf("ERROR: to_requester run failed: %v\n", err)
 		}
 		err = json.Unmarshal([]byte(output), &serverStatus)
 		if err != nil {
@@ -100,31 +96,3 @@ func TestTOUpdater(t *testing.T) {
 	})
 	fmt.Println("------------- End of TestTOUpdater tests ---------------")
 }
-
-func ExecTOUpdater(host string, reval_status bool, update_status bool) error {
-	args := []string{
-		"--traffic-ops-insecure=true",
-		"--login-dispersion=0",
-		"--traffic-ops-timeout-milliseconds=3000",
-		"--traffic-ops-user=" + tcd.Config.TrafficOps.Users.Admin,
-		"--traffic-ops-password=" + tcd.Config.TrafficOps.UserPassword,
-		"--traffic-ops-url=" + tcd.Config.TrafficOps.URL,
-		"--cache-host-name=" + host,
-		"--log-location-error=test.log",
-		"--log-location-info=test.log",
-		"--log-location-debug=test.log",
-		"--set-reval-status=" + strconv.FormatBool(reval_status),
-		"--set-update-status=" + strconv.FormatBool(update_status),
-	}
-	cmd := exec.Command("/opt/ort/to_updater", args...)
-	var out bytes.Buffer
-	var errOut bytes.Buffer
-	cmd.Stdout = &out
-	cmd.Stderr = &errOut
-	err := cmd.Run()
-	if err != nil {
-		return errors.New(err.Error() + ": " + "stdout: " + out.String() + " stderr: " + errOut.String())
-	}
-
-	return nil
-}