Skip to content

Commit

Permalink
[gui-tests][full-ci] use XDG_CONFIG_HOME with custom location for A…
Browse files Browse the repository at this point in the history
…UT during squish tests (#11316)

* remove use of --confdir

* use XDG_CONFIG_HOME env for AUT to set custom config dir

* address reviews
  • Loading branch information
saw-jan authored Oct 27, 2023
1 parent 37b37de commit 751d9b8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions test/gui/envs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
XDG_CONFIG_HOME=/tmp/owncloudtest/
25 changes: 24 additions & 1 deletion test/gui/shared/scripts/helpers/ConfigHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
from tempfile import gettempdir
from configparser import ConfigParser


def read_env_file():
envs = {}
script_path = os.path.dirname(os.path.realpath(__file__))
env_path = os.path.abspath(os.path.join(script_path, '..', '..', '..', 'envs.txt'))
with open(env_path, "rt", encoding="UTF-8") as f:
for line in f:
if line.startswith('#'):
continue
key, value = line.split('=', 1)
envs[key] = value.strip()
return envs


def get_config_from_env_file(env):
envs = read_env_file()
if env in envs:
return envs[env]
raise Exception('Environment "%s" not found in envs.txt' % env)


# map environment variables to config keys
CONFIG_ENV_MAP = {
'localBackendUrl': 'BACKEND_HOST',
Expand Down Expand Up @@ -30,7 +51,9 @@
'clientLogFile': '-',
'clientRootSyncPath': '/tmp/client-bdd/',
'tempFolderPath': gettempdir() + '/client-bdd/temp/',
'clientConfigDir': '/tmp/owncloud-client/',
'clientConfigDir': os.path.join(
get_config_from_env_file("XDG_CONFIG_HOME"), "ownCloud"
),
'guiTestReportDir': os.path.abspath('../reports/'),
'ocis': False,
'custom_lib': os.path.abspath('../shared/scripts/custom_lib'),
Expand Down
2 changes: 0 additions & 2 deletions test/gui/shared/scripts/helpers/SetupClientHelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ def startClient():
+ get_config('clientLogFile')
+ " --logdebug"
+ " --logflush"
+ " --confdir "
+ get_config('clientConfigDir')
)


Expand Down
2 changes: 1 addition & 1 deletion test/gui/suite.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
AUT=owncloud --showsettings
ENVVARS=envvars
ENVVARS=envs.txt
HOOK_SUB_PROCESSES=false
IMPLICITAUTSTART=false
LANGUAGE=Python
Expand Down

0 comments on commit 751d9b8

Please sign in to comment.