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