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 2022/08/19 19:47:45 UTC

[trafficcontrol] branch master updated: t3c integration tests to not modify config file (#7028)

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 2895a4f515 t3c integration tests to not modify config file (#7028)
2895a4f515 is described below

commit 2895a4f515482098fb94d8cb5bf4737791eb1766
Author: Joe Pappano <jo...@cable.comcast.com>
AuthorDate: Fri Aug 19 15:47:39 2022 -0400

    t3c integration tests to not modify config file (#7028)
    
    * write tc-fixtures.json to tmp file and move to container
    
    * use tc-fixtures.json from container
---
 cache-config/testing/docker/ort_test/run.sh            | 8 +++-----
 cache-config/testing/ort-tests/traffic_ops_ort_test.go | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/cache-config/testing/docker/ort_test/run.sh b/cache-config/testing/docker/ort_test/run.sh
index ebb3d69813..1af3742fc7 100755
--- a/cache-config/testing/docker/ort_test/run.sh
+++ b/cache-config/testing/docker/ort_test/run.sh
@@ -77,8 +77,8 @@ else
   echo "$(</ort-tests/tc-fixtures.json jq --arg ATS_RPM "$ATS_RPM" '.profiles[] |= (
     select(.params != null).params[] |= (
       select(.configFile == "package" and .name == "trafficserver").value = $ATS_RPM
-    ))')" >/ort-tests/tc-fixtures.json
-  if ! </ort-tests/tc-fixtures.json jq -r --arg ATS_RPM "$ATS_RPM" '.profiles[] |
+    ))')" >/ort-tests/tc-fixtures.json.tmp
+  if ! </ort-tests/tc-fixtures.json.tmp jq -r --arg ATS_RPM "$ATS_RPM" '.profiles[] |
     select(.params != null).params[] |
     select(.configFile == "package" and .name == "trafficserver")
     .value' |
@@ -106,7 +106,7 @@ while ! nc $TO_HOSTNAME $TO_PORT </dev/null; do
   fi
 done
 
-cp /ort-tests/tc-fixtures.json /tc-fixtures.json
+mv /ort-tests/tc-fixtures.json.tmp /tc-fixtures.json
 (touch test.log && chmod a+rw test.log && tail -f test.log)&
 
 go test --cfg=conf/docker-edge-cache.conf 2>&1 >> test.log
@@ -115,6 +115,4 @@ if [[ $? != 0 ]]; then
   exit 3
 fi
 
-cp /tc-fixtures.json /ort-tests/tc-fixtures.json
-
 exit 0
diff --git a/cache-config/testing/ort-tests/traffic_ops_ort_test.go b/cache-config/testing/ort-tests/traffic_ops_ort_test.go
index 8fa43276a5..c96961aed8 100644
--- a/cache-config/testing/ort-tests/traffic_ops_ort_test.go
+++ b/cache-config/testing/ort-tests/traffic_ops_ort_test.go
@@ -51,7 +51,7 @@ const cfgFmt = `Using Config values:
 func TestMain(m *testing.M) {
 	tcd = tcdata.NewTCData()
 	configFileName := flag.String("cfg", "conf/traffic-ops-test.conf", "The config file path")
-	tcFixturesFileName := flag.String("fixtures", "tc-fixtures.json", "The test fixtures for the API test tool")
+	tcFixturesFileName := flag.String("fixtures", "/tc-fixtures.json", "The test fixtures for the API test tool")
 	cliIncludeSystemTests := *flag.Bool("includeSystemTests", false, "Whether to enable tests that have environment dependencies beyond a database")
 	flag.Parse()