def test_conf_check_required_files(self): # pylint: disable=no-self-use os.environ['SCT_CLUSTER_BACKEND'] = 'aws' os.environ['SCT_CONFIG_FILES'] = 'internal_test_data/minimal_test_case.yaml' os.environ['SCT_STRESS_CMD'] = """cassandra-stress user profile=/tmp/cs_profile_background_reads_overload.yaml \ ops'(insert=100)' no-warmup cl=ONE duration=10m -port jmx=6868 \ -mode cql3 native -rate threads=3000 -errors ignore""" conf = SCTConfiguration() conf.verify_configuration() conf.check_required_files()
def test_conf_check_required_files_negative(self): # pylint: disable=no-self-use os.environ['SCT_CLUSTER_BACKEND'] = 'aws' os.environ['SCT_CONFIG_FILES'] = 'internal_test_data/stress_cmd_with_bad_profile.yaml' os.environ['SCT_STRESS_CMD'] = """cassandra-stress user profile=/tmp/1232123123123123123.yaml ops'(insert=100)'\ no-warmup cl=ONE duration=10m -port jmx=6868 -mode cql3 native -rate threads=3000 -errors ignore""" conf = SCTConfiguration() conf.verify_configuration() try: conf.check_required_files() except ValueError as exc: self.assertEqual(str( exc), "Stress command parameter \'stress_cmd\' contains profile \'/tmp/1232123123123123123.yaml\' that" " does not exists under data_dir/")
def conf(config_file, backend): if backend: os.environ['SCT_CLUSTER_BACKEND'] = backend os.environ['SCT_CONFIG_FILES'] = config_file config = SCTConfiguration() try: config.verify_configuration() config.check_required_files() except Exception as ex: # pylint: disable=broad-except click.secho(str(ex), fg='red') sys.exit(1) else: click.secho(config.dump_config(), fg='green') sys.exit(0)