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 4babb3940f Supplying absolute path for cert files in tests (#7742)
4babb3940f is described below

commit 4babb3940fbcff961473b33d557be96cbb629e4d
Author: Srijeet Chatterjee <[email protected]>
AuthorDate: Wed Aug 23 15:27:49 2023 -0600

    Supplying absolute path for cert files in tests (#7742)
    
    * Supplying absolute path for cert files in tests
    
    * Adding changelog
---
 CHANGELOG.md                               |  1 +
 traffic_ops/testing/api/v5/session_test.go | 27 ++++++++++++++++++---------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56f21ba8f3..16eaf2d80f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -74,6 +74,7 @@ The format is based on [Keep a 
Changelog](http://keepachangelog.com/en/1.0.0/).
 - [#7694](https://github.com/apache/trafficcontrol/pull/7694) *t3c*, *Traffic 
Control Health Client* Upgrade to ATS 9.2
 - [#7966](https://github.com/apache/trafficcontrol/pull/7696) *t3c* will no 
longer clear update flag when config failure occurs and will also give a cache 
config error msg on exit. 
 - [#7716](https://github.com/apache/trafficcontrol/pull/7716) *Apache Traffic 
Server* Use GCC 11 for building.
+- [#7742](https://github.com/apache/trafficcontrol/pull/7742) *Traffic Ops* 
Changed api tests to supply the absolute path of certs.
 
 ### Fixed
 - [#7730](https://github.com/apache/trafficcontrol/pull/7730) *Traffic 
Monitor* Fixed the panic seen in TM when `plugin.system_stats.timestamp_ms` 
appears as float and not string.
diff --git a/traffic_ops/testing/api/v5/session_test.go 
b/traffic_ops/testing/api/v5/session_test.go
index 8af489bf0b..d85897646f 100644
--- a/traffic_ops/testing/api/v5/session_test.go
+++ b/traffic_ops/testing/api/v5/session_test.go
@@ -16,6 +16,8 @@ package v5
 */
 
 import (
+       "fmt"
+       "os"
        "testing"
        "time"
 
@@ -56,14 +58,21 @@ func SwitchSession(toReqTimeout time.Duration, toURL 
string, toOldUser string, t
 }
 
 func TestLoginWithCert(t *testing.T) {
-       session, _, err := client.LoginWithCert(Config.TrafficOps.URL, true, 
time.Second*60,
-               "./client-intermediate-chain.crt.pem",
-               "./client.key.pem", "")
-
-       if err != nil {
-               t.Fatalf("expected no error while logging in with cert, but got 
%v", err)
-       }
-       if session == nil {
-               t.Fatalf("expected a valid session, but got nothing")
+       if includeSystemTests {
+               pwd, err := os.Getwd()
+               if err != nil {
+                       t.Fatalf("couldn't get current working directory: %s", 
err.Error())
+               }
+
+               session, _, err := client.LoginWithCert(Config.TrafficOps.URL, 
true, time.Second*60,
+                       fmt.Sprintf("%s/client-intermediate-chain.crt.pem", 
pwd),
+                       fmt.Sprintf("%s/client.key.pem", pwd), "")
+
+               if err != nil {
+                       t.Fatalf("expected no error while logging in with cert, 
but got %v", err)
+               }
+               if session == nil {
+                       t.Fatalf("expected a valid session, but got nothing")
+               }
        }
 }

Reply via email to