Skip to content
Snippets Groups Projects
Unverified Commit 94fa53bc authored by Varac's avatar Varac
Browse files

Get username and pw from k8s secrets

parent ebee4670
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@
/install/installation-kustomization/*.txt
# Ignore files created during tests
/**/Screenshot-*.png
Screenshot-*.png
# Etc
__pycache__
......
......@@ -27,8 +27,6 @@ from subprocess import Popen, PIPE
import greenhost_cloud
from openappstack import name, cluster, ansible
ALL_TESTS = ['taiko']
# We're limiting to 50, because we use subdomains, the current longest of which
# is 7 characters (`office.`). Max CN length is 63 characters, so we have some
# wiggle room for longer subdomains in the future.
......@@ -209,24 +207,16 @@ def main(): # pylint: disable=too-many-statements,too-many-branches,too-many-lo
test_parser.set_defaults(func=test)
test_parser.add_argument(
'--run-test',
action='append',
help=('Run only a specific kind of test. If not provided, all tests '
'are run. The currently available tests are: ') \
+ ','.join(ALL_TESTS))
test_parser.add_argument(
'--observe',
action='store_true',
help=('Run taiko in observe mode'))
test_parser.add_argument(
'--browser-args',
metavar=['PARAM[=VALUE]'],
action='append',
nargs=1,
default=[],
help=('Pass additional browser args (like "--ignore-certificate-errors"'))
'--apps',
action='store_true',
default='all',
help=('Which apps to test (i.e. "nextcloud,wordpress". Defaults to'
'"all".'))
info_parser = subparsers.add_parser(
'info',
......@@ -405,41 +395,42 @@ def test(clus, args):
:param argparse.Namespace args: Command line arguments
"""
# At the moment we only have one type if test, but more tests will be added
# to this in the future. If args.run_test is empty, we run all the tests
run_test = args.run_test
if not run_test:
run_test = ALL_TESTS
if 'taiko' in run_test:
taiko_path = os.path.join(os.path.dirname(__file__), '..', 'test',
'taiko')
# Run from the taiko directory so taiko automatically loads all the
# necessary files
os.chdir(taiko_path)
clus.load_data()
command = ['/bin/echo', 'hi']
if args.observe:
command.append('--observe')
for tag in args.browser_args:
log.info(command)
command.append('-t {tag}'.format(tag=tag))
if args.browser_args:
for param in args.browser_args:
if len(param) > 1:
log.warning('More than 1 parameter. Ignoring the rest! '
'Use --browser_args several times to supply '
'more than 1 parameter')
param = param[0]
command.append(param)
log.info('Running taiko command %s', command)
taiko = Popen(command, stdout=PIPE)
output = taiko.communicate()[0]
return_code = (taiko.returncode)
print(return_code)
print(output)
sys.exit(return_code)
taiko_path = os.path.join(os.path.dirname(__file__), '..', 'test', 'taiko')
# Run from the taiko directory so taiko automatically loads all the
# necessary files
os.chdir(taiko_path)
clus.load_data()
command = ['taiko']
if args.observe:
command.append('--observe')
command.append('taiko-tests.js')
# Set env vars
username = clus.get_password_from_kubernetes(
'oas-single-sign-on-variables',
'userbackend_admin_username',
'flux-system'
)
password = clus.get_password_from_kubernetes(
'oas-single-sign-on-variables',
'userbackend_admin_password',
'flux-system'
)
print(username, password)
os.environ['DOMAIN'] = clus.domain
os.environ["SSO_USERNAME"] = username
os.environ["SSO_USER_PW"] = password
os.environ["TAIKO_TESTS"] = args.apps
log.info('Running taiko command %s', command)
with Popen(command, stdout=PIPE, bufsize=1,
universal_newlines=True) as taiko:
for line in taiko.stdout:
print(line, end='')
return_code = (taiko.returncode)
sys.exit(return_code)
def create_domain_records(domain, droplet_ip, subdomain=None):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment