def main(): result = True results = {} print("Starting App Connectivity Tests...") start = time.time() try: #All foundations deployment apps print("Testing apps manager health...") r = requests.get(apps_manager_url) results['apps_manager'] = (r.status_code == 200) if not results['apps_manager']: print('Apps manager health check failed!') print("Testing app1 health...") r = requests.get(app1_url) results['app1'] = (r.status_code == 200) if not results['app1']: print('app1 health check failed!') # Add more internal-apps health-check here except Exception as e: print(str(e)) result = False print("Finished App Connectivity Tests...") print(json.dumps(results, indent=1)) end = time.time() minutes_taken = (end - start) / 60 print("Total time taken: {} minutes".format(minutes_taken)) results['minutes_taken'] = minutes_taken report_results.send_metric_to_influxdb('app-connectivity', results) return not result
def main(): result = True results = {} print("Starting Redis smoke-test...") start = time.time() try: results['set_api'] = common_tests.set_api() if not results['set_api']: raise Exception('set_api failed') results['authenticate'] = common_tests.authenticate() if not results['authenticate']: raise Exception('authenticate failed') results['set_target'] = common_tests.set_target() if not results['set_target']: raise Exception('set_target failed') results['list_marketplace_service'] = common_tests.list_marketplace_service(redis_service_name) if not results['list_marketplace_service']: raise Exception('list_marketplace_service failed') print("Testing shared-vm plan...") shared_vm_results, result = test_shared_plan() for key, value in shared_vm_results.items(): results['shared_vm.{}'.format(key)] = value #print("Testing dedicated-vm plan...") #dedicated_vm_results, result = test_dedicated_plan() #for key, value in dedicated_vm_results.items(): # results['dedicated_vm.{}'.format(key)] = value except Exception as e: print(str(e)) result = False if result and not all(value == True for value in results.values()): result = False print("Finished Redis smoke-test...") print(json.dumps(results, indent=1)) print("Overall result: {}".format("Passed" if result else "Failed")) end = time.time() minutes_taken = (end-start)/60 print("Total time taken: {} minutes".format(minutes_taken)) results['overall_result'] = result results['minutes_taken'] = minutes_taken report_results.send_metric_to_influxdb('redis', results) return not result
def main(): result = True results = {} print("Starting AUTO-SCALING smoke-test...") start = time.time() try: os.environ['CF_DIAL_TIMEOUT'] = "30" print(os.environ['CF_DIAL_TIMEOUT']) results['autoscale_state'] = check_autoscaling_app_state('autoscale') if not results['autoscale_state']: raise Exception('autoscale app is down') results['autoscale_api_state'] = check_autoscaling_app_state( 'autoscale-api') if not results['autoscale_api_state']: raise Exception('autoscale-api app is down') results['set_api'] = common_tests.set_api() if not results['set_api']: raise Exception('set_api failed') results['authenticate'] = common_tests.authenticate() if not results['authenticate']: raise Exception('authenticate failed') results['set_target'] = common_tests.set_target() if not results['set_target']: raise Exception('set_target failed') results['pivnet_login'] = common_tests.pivnet_login() if not results['pivnet_login']: raise Exception('pivnet_login failed') results[ 'pivnet_get_product_id'], product_id = common_tests.pivnet_get_product_id( autoscaler_product, autoscaler_product_version, 'linux64') if not results['pivnet_get_product_id']: raise Exception('pivnet_get_product_id failed') results['pivnet_accept_eula'] = common_tests.pivnet_accept_eula( autoscaler_product, autoscaler_product_version) if not results['pivnet_accept_eula']: raise Exception('pivnet_accept_eula failed') results[ 'pivnet_download_product_files'] = common_tests.pivnet_download_product_files( autoscaler_product, autoscaler_product_version, product_id) if not results['pivnet_download_product_files']: raise Exception('pivnet_download_product_files failed') results['pivnet_logout'] = common_tests.pivnet_logout() if not results['pivnet_logout']: raise Exception('pivnet_logout failed') results['install_autoscaler_plugin'] = utils.run_cmd( "cf install-plugin -f {}".format( os.path.join(os.getcwd(), glob.glob('autoscaler-for-pcf-*')[0]))) if not results['install_autoscaler_plugin']: raise Exception('install_autoscaler_plugin failed') results['create_service'] = common_tests.create_service( autoscaler_service_name, autoscaler_service_plan, autoscaler_service_instance) if not results['create_service']: raise Exception('create_service failed') manifest_path = os.path.join(autoscaler_sample_app_path, 'manifest.yml') params = "{} -f {} -p {} --no-start".format( autoscaler_sample_app, manifest_path, autoscaler_sample_app_path) results['push_app'] = common_tests.push_app(params) if not results['push_app']: results['get_app_logs'] = common_tests.get_app_logs( autoscaler_sample_app) raise Exception('push_app failed') results['bind_service'] = common_tests.bind_service( autoscaler_sample_app, autoscaler_service_instance) if not results['bind_service']: raise Exception('bind_service failed') results['start_app'] = common_tests.start_app(autoscaler_sample_app) if not results['start_app']: results['get_app_logs'] = common_tests.get_app_logs( autoscaler_sample_app) raise Exception('start_app failed') min_instances = 3 max_instances = 5 results['update_autoscaling_limits'] = utils.run_cmd( "cf update-autoscaling-limits {} {} {}".format( autoscaler_sample_app, min_instances, max_instances)) if not results['update_autoscaling_limits']: raise Exception('update_autoscaling_limits failed') results['enable_autoscaling'] = utils.run_cmd( "cf enable-autoscaling {}".format(autoscaler_sample_app)) if not results['enable_autoscaling']: raise Exception('enable_autoscaling failed') results['autoscaling_apps'] = utils.run_cmd("cf autoscaling-apps") if not results['autoscaling_apps']: raise Exception('autoscaling_apps failed') results['autoscaling_rules'] = utils.run_cmd( "cf autoscaling-rules {}".format(autoscaler_sample_app)) if not results['autoscaling_rules']: raise Exception('autoscaling_rules failed') results['create_rule_http_throughput'] = utils.run_cmd( "cf create-autoscaling-rule {} http_throughput 10 50".format( autoscaler_sample_app)) if not results['create_rule_http_throughput']: raise Exception('create_rule_http_throughput failed') results['create_rule_http_latency'] = utils.run_cmd( "cf create-autoscaling-rule {} http_latency 10 20 -s avg_99th". format(autoscaler_sample_app)) if not results['create_rule_http_latency']: raise Exception('create_rule_http_latency failed') results['create_rule_cpu'] = utils.run_cmd( "cf create-autoscaling-rule {} cpu 10 60".format( autoscaler_sample_app)) if not results['create_rule_cpu']: raise Exception('create_rule_cpu failed') results['create_rule_memory'] = utils.run_cmd( "cf create-autoscaling-rule {} memory 20 80".format( autoscaler_sample_app)) if not results['create_rule_memory']: raise Exception('create_rule_memory failed') results['autoscaling_rules'] = utils.run_cmd( "cf autoscaling-rules {}".format(autoscaler_sample_app)) if not results['autoscaling_rules']: raise Exception('autoscaling_rules failed') generate_http_traffic() results['autoscaling_events'] = utils.run_cmd( "cf autoscaling-events {}".format(autoscaler_sample_app)) if not results['autoscaling_events']: raise Exception('autoscaling_events failed') except Exception as e: print(str(e)) result = False finally: try: results['delete_autoscaling_rules'] = utils.run_cmd( "cf delete-autoscaling-rules -f {}".format( autoscaler_sample_app)) if not results['delete_autoscaling_rules']: print('delete_autoscaling_rules failed') except Exception as e: print(str(e)) result = False try: results['disable_autoscaling'] = utils.run_cmd( 'cf disable-autoscaling {}'.format(autoscaler_sample_app)) if not results['disable_autoscaling']: print('disable_autoscaling failed') except Exception as e: print(str(e)) result = False try: results['unbind_service'] = common_tests.unbind_service( autoscaler_sample_app, autoscaler_service_instance) if not results['unbind_service']: print('unbind_service failed') except Exception as e: print(str(e)) result = False try: results['delete_app'] = common_tests.delete_app( autoscaler_sample_app) if not results['delete_app']: print('delete_app failed') except Exception as e: print(str(e)) result = False try: results['delete_service'] = common_tests.delete_service( autoscaler_service_instance) if not results['delete_service']: print('delete_service failed') except Exception as e: print(str(e)) result = False if result and not all(value == True for value in results.values()): result = False print("Finished AUTO-SCALING smoke-test...") print(json.dumps(results, indent=1)) print("Overall result: {}".format("Passed" if result else "Failed")) end = time.time() minutes_taken = (end - start) / 60 print("Total time taken: {} minutes".format(minutes_taken)) results['overall_result'] = result results['minutes_taken'] = minutes_taken report_results.send_metric_to_influxdb('auto-scaler', results) return not result
def main(): result = True results = {} print("Starting RabbitMQ smoke-test...") start = time.time() try: results['set_api'] = common_tests.set_api() if not results['set_api']: raise Exception('set_api failed') results['authenticate'] = common_tests.authenticate() if not results['authenticate']: raise Exception('authenticate failed') results['set_target'] = common_tests.set_target() if not results['set_target']: raise Exception('set_target failed') results[ 'list_marketplace_service'] = common_tests.list_marketplace_service( rabbimq_service_name) if not results['list_marketplace_service']: raise Exception('list_marketplace_service failed') results['create_service'] = common_tests.create_service( rabbimq_service_name, rabbitmq_service_plan, rabbitmq_service_instance) if not results['create_service']: raise Exception('create_service failed') results['show_service_info'] = common_tests.show_service_info( rabbitmq_service_instance) if not results['show_service_info']: raise Exception('show_service_info failed') manifest_path = os.path.join(rabbitmq_sample_app_path, 'manifest.yml') params = "{} -f{} -p {} --no-start".format(rabbitmq_sample_app, manifest_path, rabbitmq_sample_app_path) results['push_app'] = common_tests.push_app(params) if not results['push_app']: raise Exception('push_app failed') results['bind_service'] = common_tests.bind_service( rabbitmq_sample_app, rabbitmq_service_instance) if not results['bind_service']: raise Exception('bind_service failed') results['start_app'] = common_tests.start_app(rabbitmq_sample_app) if not results['start_app']: results['get_app_logs'] = common_tests.get_app_logs( rabbitmq_sample_app) raise Exception('start_app failed') test_app_result = test_rabbitmq_app() results['test_app_write'] = test_app_result['write'] if not results['test_app_write']: raise Exception('test_app_write failed') results['test_app_read'] = test_app_result['read'] if not results['test_app_read']: raise Exception('test_app_read failed') except Exception as e: print(str(e)) result = False finally: try: results['unbind_service'] = common_tests.unbind_service( rabbitmq_sample_app, rabbitmq_service_instance) if not results['unbind_service']: print('unbind_service failed') except Exception as e: print(str(e)) result = False try: results['delete_app'] = common_tests.delete_app( rabbitmq_sample_app) if not results['delete_app']: print('delete_app failed') except Exception as e: print(str(e)) result = False try: results['delete_service'] = common_tests.delete_service( rabbitmq_service_instance) if not results['delete_service']: print('delete_service failed') except Exception as e: print(str(e)) result = False if result and not all(value == True for value in results.values()): result = False print("Finished RabbitMQ smoke-test...") print(json.dumps(results, indent=1)) print("Overall result: {}".format("Passed" if result else "Failed")) end = time.time() minutes_taken = (end - start) / 60 print("Total time taken: {} minutes".format(minutes_taken)) results['overall_result'] = result results['minutes_taken'] = minutes_taken report_results.send_metric_to_influxdb('rabbitmq', results) return not result
def main(): result = True results = {} print("Starting SCS smoke-test...") start = time.time() try: results['set_api'] = common_tests.set_api() if not results['set_api']: raise Exception('set_api failed') results['authenticate'] = common_tests.authenticate() if not results['authenticate']: raise Exception('authenticate failed') results['set_target'] = common_tests.set_target() if not results['set_target']: raise Exception('set_target failed') config_server_config = { "git": { "uri": scs_sample_app_uri, "privateKey": scs_sample_app_key, "searchPaths": "sample_apps/scs-sample-app/configuration" } } results['config_server.create_service'] = common_tests.create_service( config_server_service_name, config_server_service_plan, config_server_service_instance, config_server_config) if not results['config_server.create_service']: raise Exception('create_service failed for config_server') results[ 'service_registry.create_service'] = common_tests.create_service( service_registry_service_name, service_registry_service_plan, service_registry_service_instance) if not results['service_registry.create_service']: raise Exception('create_service failed for service_registry') results[ 'circuit_breaker.create_service'] = common_tests.create_service( circuit_breaker_service_name, circuit_breaker_service_plan, circuit_breaker_service_instance) if not results['circuit_breaker.create_service']: raise Exception('create_service failed for circuit_breaker') results['mysql.create_service'] = common_tests.create_service( mysql_service_name, mysql_service_plan, mysql_service_instance) if not results['mysql.create_service']: raise Exception('create_service failed for mysql') results[ 'config_server.show_service_info'] = common_tests.show_service_info( config_server_service_instance) if not results['config_server.show_service_info']: raise Exception('show_service_info failed for config_server') results[ 'service_registry.show_service_info'] = common_tests.show_service_info( service_registry_service_instance) if not results['service_registry.show_service_info']: raise Exception('show_service_info failed for service_registry') results[ 'circuit_breaker.show_service_info'] = common_tests.show_service_info( circuit_breaker_service_instance) if not results['circuit_breaker.show_service_info']: raise Exception('show_service_info failed for circuit_breaker') params = "{} -f {} --no-start".format(fortune_ui_app, fortune_ui_app_path) results['fortune_ui.push_app'] = common_tests.push_app(params) if not results['fortune_ui.push_app']: raise Exception('push_app failed for fortune_ui_app') params = "{} -f {} --no-start".format(fortune_svc_app, fortune_svc_app_path) results['fortune_svc.push_app'] = common_tests.push_app(params) if not results['fortune_svc.push_app']: raise Exception('push_app failed for fortune_svc_app') results[ 'config_server.fortune_ui.bind_service'] = common_tests.bind_service( fortune_ui_app, config_server_service_instance) if not results['config_server.fortune_ui.bind_service']: raise Exception( 'bind_service failed for config_server - fortune_ui_app') results[ 'service_registry.fortune_ui.bind_service'] = common_tests.bind_service( fortune_ui_app, service_registry_service_instance) if not results['service_registry.fortune_ui.bind_service']: raise Exception( 'bind_service failed for service_registry - fortune_ui_app') results[ 'circuit_breaker.fortune_ui.bind_service'] = common_tests.bind_service( fortune_ui_app, circuit_breaker_service_instance) if not results['circuit_breaker.fortune_ui.bind_service']: raise Exception( 'bind_service failed for circuit_breaker - fortune_ui_app') results[ 'config_server.fortune_svc.bind_service'] = common_tests.bind_service( fortune_svc_app, config_server_service_instance) if not results['config_server.fortune_svc.bind_service']: raise Exception( 'bind_service failed for config_server - fortune_svc_app') results[ 'service_registry.fortune_svc.bind_service'] = common_tests.bind_service( fortune_svc_app, service_registry_service_instance) if not results['service_registry.fortune_svc.bind_service']: raise Exception( 'bind_service failed for service_registry - fortune_svc_app') results[ 'circuit_breaker.fortune_svc.bind_service'] = common_tests.bind_service( fortune_svc_app, circuit_breaker_service_instance) if not results['circuit_breaker.fortune_svc.bind_service']: raise Exception( 'bind_service failed for circuit_breaker - fortune_svc_app') results['fortune_ui.start_app'] = common_tests.start_app( fortune_ui_app) if not results['fortune_ui.start_app']: results['fortune_ui.get_app_logs'] = common_tests.get_app_logs( fortune_ui_app) raise Exception('start_app failed for fortune_ui_app') results['fortune_svc.start_app'] = common_tests.start_app( fortune_svc_app) if not results['fortune_svc.start_app']: results['fortune_svc.get_app_logs'] = common_tests.get_app_logs( fortune_svc_app) raise Exception('start_app failed for fortune_svc_app') results.update(test_scs_app()) if not results['fortune_ui.health']: raise Exception('health-check failed for fortune_ui_app') if not results['fortune_ui.random']: raise Exception('config-check failed for fortune_ui_app') if not results['fortune_svc.health']: raise Exception('health-check failed for fortune_svc_app') except Exception as e: print(str(e)) result = False finally: try: results[ 'config_server.fortune_ui.unbind_service'] = common_tests.unbind_service( fortune_ui_app, config_server_service_instance) if not results['config_server.fortune_ui.unbind_service']: print( 'unbind_service failed for config_server - fortune_ui_app') except Exception as e: print(str(e)) result = False try: results[ 'service_registry.fortune_ui.unbind_service'] = common_tests.unbind_service( fortune_ui_app, service_registry_service_instance) if not results['service_registry.fortune_ui.unbind_service']: print( 'unbind_service failed for service_registry - fortune_ui_app' ) except Exception as e: print(str(e)) result = False try: results[ 'circuit_breaker.fortune_ui.unbind_service'] = common_tests.unbind_service( fortune_ui_app, circuit_breaker_service_instance) if not results['circuit_breaker.fortune_ui.unbind_service']: print( 'unbind_service failed for circuit_breaker - fortune_ui_app' ) except Exception as e: print(str(e)) result = False try: results[ 'config_server.fortune_svc.unbind_service'] = common_tests.unbind_service( fortune_svc_app, config_server_service_instance) if not results['config_server.fortune_svc.unbind_service']: print( 'unbind_service failed for config_server - fortune_svc_app' ) except Exception as e: print(str(e)) result = False try: results[ 'service_registry.fortune_svc.unbind_service'] = common_tests.unbind_service( fortune_svc_app, service_registry_service_instance) if not results['service_registry.fortune_svc.unbind_service']: print( 'unbind_service failed for service_registry - fortune_svc_app' ) except Exception as e: print(str(e)) result = False try: results[ 'circuit_breaker.fortune_svc.unbind_service'] = common_tests.unbind_service( fortune_svc_app, circuit_breaker_service_instance) if not results['circuit_breaker.fortune_svc.unbind_service']: print( 'unbind_service failed for circuit_breaker - fortune_svc_app' ) except Exception as e: print(str(e)) result = False try: results['fortune_ui.delete_app'] = common_tests.delete_app( fortune_ui_app) if not results['fortune_ui.delete_app']: print('delete_app failed for fortune_ui_app') except Exception as e: print(str(e)) result = False try: results['fortune_svc.delete_app'] = common_tests.delete_app( fortune_svc_app) if not results['fortune_svc.delete_app']: print('delete_app failed for fortune_svc_app') except Exception as e: print(str(e)) result = False try: results['mysql.delete_service'] = common_tests.delete_service( mysql_service_instance) if not results['mysql.delete_service']: print('delete_service failed for mysql') except Exception as e: print(str(e)) result = False try: results[ 'config_server.delete_service'] = common_tests.delete_service( config_server_service_instance) if not results['config_server.delete_service']: print('delete_service failed for config_server') except Exception as e: print(str(e)) result = False try: results[ 'service_registry.delete_service'] = common_tests.delete_service( service_registry_service_instance) if not results['service_registry.delete_service']: print('delete_service failed for service_registry') except Exception as e: print(str(e)) result = False try: results[ 'circuit_breaker.delete_service'] = common_tests.delete_service( circuit_breaker_service_instance) if not results['circuit_breaker.delete_service']: print('delete_service failed for circuit_breaker') except Exception as e: print(str(e)) result = False if result and not all(value == True for value in results.values()): result = False print("Finished SCS smoke-test...") print(json.dumps(results, indent=1)) print("Overall result: {}".format("Passed" if result else "Failed")) end = time.time() minutes_taken = (end - start) / 60 print("Total time taken: {} minutes".format(minutes_taken)) results['overall_result'] = result results['minutes_taken'] = minutes_taken report_results.send_metric_to_influxdb('scs', results) return not result
def main(): result = True results = {} print("Starting PAS smoke-test...") start = time.time() try: results['set_api'] = common_tests.set_api() if not results['set_api']: raise Exception('set_api failed') results['authenticate'] = common_tests.authenticate() if not results['authenticate']: raise Exception('authenticate failed') results['set_target'] = common_tests.set_target() if not results['set_target']: raise Exception('set_target failed') manifest_path = os.path.join(pas_sample_app_path, 'manifest.yml') params = "{} -f {} -p {} --no-start".format(pas_sample_app, manifest_path, pas_sample_app_path) results['push_app'] = common_tests.push_app(params) if not results['push_app']: results['get_app_logs'] = common_tests.get_app_logs(pas_sample_app) raise Exception('push_app failed') results['start_app'] = common_tests.start_app(pas_sample_app) if not results['start_app']: results['get_app_logs'] = common_tests.get_app_logs(pas_sample_app) raise Exception('start_app failed') num_instances = 5 results['scale_up_app'] = common_tests.scale_app( pas_sample_app, num_instances) if not results['scale_up_app']: raise Exception('scale_up_app failed') print('Sleeping for 20 seconds to let all instances come up...') time.sleep(20) results['show_app_info'] = common_tests.show_app_info(pas_sample_app) if not results['show_app_info']: raise Exception('show_app_info failed') results[ 'test_app_instances_connection'] = test_app_instances_connection( num_instances) if not results['test_app_instances_connection']: raise Exception('test_app_instances_connection failed') results['scale_down_app'] = common_tests.scale_app(pas_sample_app, 1) if not results['scale_down_app']: raise Exception('scale_down_app failed') results['get_app_logs'] = common_tests.get_app_logs(pas_sample_app) if not results['get_app_logs']: raise Exception('get_app_logs failed') except Exception as e: print(str(e)) result = False finally: try: results['delete_app'] = common_tests.delete_app(pas_sample_app) if not results['delete_app']: print('delete_app failed') except Exception as e: print(str(e)) result = False if result and not all(value == True for value in results.values()): result = False print("Finished PAS smoke-test...") print(json.dumps(results, indent=1)) print("Overall result: {}".format("Passed" if result else "Failed")) end = time.time() minutes_taken = (end - start) / 60 print("Total time taken: {} minutes".format(minutes_taken)) results['overall_result'] = result results['minutes_taken'] = minutes_taken report_results.send_metric_to_influxdb('pas', results) return not result
def main(): result = True results = {} print("Starting PCC smoke-test...") start = time.time() try: results['set_api'] = common_tests.set_api() if not results['set_api']: raise Exception('set_api failed') results['authenticate'] = common_tests.authenticate() if not results['authenticate']: raise Exception('authenticate failed') results['set_target'] = common_tests.set_target() if not results['set_target']: raise Exception('set_target failed') results[ 'list_marketplace_service'] = common_tests.list_marketplace_service( pcc_service_name) if not results['list_marketplace_service']: raise Exception('list_marketplace_service failed') results['create_service'] = common_tests.create_service( pcc_service_name, pcc_service_plan, pcc_service_instance) if not results['create_service']: raise Exception('create_service failed') results['show_service_info'] = common_tests.show_service_info( pcc_service_instance) if not results['show_service_info']: raise Exception('show_service_info failed') results['create_service_key'] = common_tests.create_service_key( pcc_service_instance, pcc_service_key) if not results['create_service_key']: raise Exception('create_service_key failed') results[ 'show_service_key_info'], service_key = common_tests.show_service_key_info( pcc_service_instance, pcc_service_key) if not results['show_service_key_info']: raise Exception('show_service_key_info failed') else: os.environ['GEMFIRE_URL'] = str(service_key['urls']['gfsh']) for user in service_key['users']: if user['username'].startswith('cluster_operator'): os.environ['GEMFIRE_USER'] = str(user["username"]) os.environ['GEMFIRE_PASSWORD'] = str(user["password"]) break results['pivnet_login'] = common_tests.pivnet_login() if not results['pivnet_login']: raise Exception('pivnet_login failed') results[ 'pivnet_get_product_id'], product_id = common_tests.pivnet_get_product_id( gemfire_product, gemfire_product_version, 'Tar') if not results['pivnet_get_product_id']: raise Exception('pivnet_get_product_id failed') results['pivnet_accept_eula'] = common_tests.pivnet_accept_eula( gemfire_product, gemfire_product_version) if not results['pivnet_accept_eula']: raise Exception('pivnet_accept_eula failed') results[ 'pivnet_download_product_files'] = common_tests.pivnet_download_product_files( gemfire_product, gemfire_product_version, product_id) if not results['pivnet_download_product_files']: raise Exception('pivnet_download_product_files failed') results['pivnet_logout'] = common_tests.pivnet_logout() if not results['pivnet_logout']: raise Exception('pivnet_logout failed') results['extract_gemfire_tar'] = extract_gemfire_tar() if not results['extract_gemfire_tar']: raise Exception('extract_gemfire_tar failed') results['gemfire_create_regions'] = gemfire_create_regions() if not results['gemfire_create_regions']: raise Exception('gemfire_create_regions failed') results['gemfire_write'] = gemfire_write() if not results['gemfire_write']: raise Exception('gemfire_write failed') print(">>> Updating the sample-app manifest...") cmd = "cd {} && sed -i -e \'s/service0/{}/g\' manifest.yml".format( pcc_sample_app_path, pcc_service_instance) utils.run_cmd(cmd) print( ">>> Updating username, password and gemfire-version in sample-app config..." ) cmd = "cd {} && \ sed -i -e \'s/SAMPLE_USERNAME/{}/g\' gradle.properties && \ sed -i -e \'s/SAMPLE_PASSWORD/{}/g\' gradle.properties && \ sed -i -e \'s/9.0.2/{}/g\' build.gradle".format( pcc_sample_app_path, os.environ['SMOKE_USER'], os.environ['SMOKE_PASSWORD'].replace("&", "\&"), gemfire_product_version) utils.run_cmd(cmd, False, False) print(">>> Building the sample-app...") cmd = "cd {} && ./gradlew clean build".format(pcc_sample_app_path) utils.run_cmd(cmd) manifest_path = os.path.join(pcc_sample_app_path, 'manifest.yml') params = "{} -f {} -p {} --no-start".format(pcc_sample_app, manifest_path, pcc_sample_app_path) results['push_app'] = common_tests.push_app(params) if not results['push_app']: results['get_app_logs'] = common_tests.get_app_logs(pcc_sample_app) raise Exception('push_app failed') results['bind_service'] = common_tests.bind_service( pcc_sample_app, pcc_service_instance) if not results['bind_service']: raise Exception('bind_service failed') results['gemfire_read'] = gemfire_read() if not results['gemfire_read']: raise Exception('gemfire_read failed') except Exception as e: print(str(e)) result = False finally: try: results['unbind_service'] = common_tests.unbind_service( pcc_sample_app, pcc_service_instance) if not results['unbind_service']: print('unbind_service failed') except Exception as e: print(str(e)) result = False try: results['delete_service_key'] = common_tests.delete_service_key( pcc_service_instance, pcc_service_key) if not results['delete_service_key']: print('delete_service_key failed') except Exception as e: print(str(e)) result = False try: results['delete_app'] = common_tests.delete_app(pcc_sample_app) if not results['delete_app']: print('delete_app failed') except Exception as e: print(str(e)) result = False try: results['delete_service'] = common_tests.delete_service( pcc_service_instance) if not results['delete_service']: print('delete_service failed') except Exception as e: print(str(e)) result = False if result and not all(value == True for value in results.values()): result = False print("Finished PCC smoke-test...") print(json.dumps(results, indent=1)) print("Overall result: {}".format("Passed" if result else "Failed")) end = time.time() minutes_taken = (end - start) / 60 print("Total time taken: {} minutes".format(minutes_taken)) results['overall_result'] = result results['minutes_taken'] = minutes_taken report_results.send_metric_to_influxdb('pcc', results) return not result