From 18db23166c8279adf524e001615141dc1f4faae1 Mon Sep 17 00:00:00 2001
From: Xiaowu Zhang <xiaowu.zhang@nexedi.com>
Date: Thu, 9 Aug 2018 14:18:00 +0000
Subject: [PATCH] jstestnode: add remote-access-url instance parameter

this parameter is used for external service like saucelab to access test url
---
 software/jstestnode/runTestSuite.in | 13 +++++++++----
 software/jstestnode/software.cfg    |  2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/software/jstestnode/runTestSuite.in b/software/jstestnode/runTestSuite.in
index 0c49da226..cd07a30d7 100644
--- a/software/jstestnode/runTestSuite.in
+++ b/software/jstestnode/runTestSuite.in
@@ -120,10 +120,15 @@ def main():
       appium_url = "http://%s@ondemand.saucelabs.com/wd/hub" % (args.appium_server_auth)
       browser = webdriver.Remote(appium_url, capabilities)
 
-      # adjust make path to testnode's frontend
-      full_path = '$${runTestSuite-instance:buildout-directory}/software_release/parts/%s' % parsed_parameters['test-url']
-      full_path = full_path.split('srv')[-1]
-      url = "%s%s" % (args.frontend_url, full_path)
+      # adjust path for remote test url
+      remote_access_url = parsed_parameters.get('remote-access-url', None)
+      if remote_access_url:
+        if ('jio' in test_suite):
+          url = os.path.join(remote_access_url, 'jio/test/tests.html')
+        else:
+          url = os.path.join(remote_access_url, 'renderjs/test/')
+      else:
+        raise ValueError('remote-access-url is not defined in instance parameter')
 
     is_browser_running = True
     agent = browser.execute_script("return navigator.userAgent")
diff --git a/software/jstestnode/software.cfg b/software/jstestnode/software.cfg
index f140f8a70..1e3786c2f 100644
--- a/software/jstestnode/software.cfg
+++ b/software/jstestnode/software.cfg
@@ -107,7 +107,7 @@ mode = 0644
 [template-runTestSuite]
 recipe = slapos.recipe.template
 url = ${:_profile_base_location_}/runTestSuite.in
-md5sum = ff66d13f73982e8257eb5535cdb541c7
+md5sum = 0a918eb070d28abfd33e0fcca26569ff
 output = ${buildout:directory}/runTestSuite.in
 mode = 0644
 
-- 
2.30.9