def _main(): logging.getLogger().setLevel(logging.INFO) parser = argparse.ArgumentParser() parser.add_argument('--image', '-i', help='Newly-constructed base ' + 'image to build sample app on') parser.add_argument('--directory', '-d', help='Root directory of sample app') parser.add_argument('--no-deploy', action='store_false', dest='deploy', help='Flag to skip deployment of app ' + '(must provide app URL)') parser.add_argument('--skip-logging-tests', action='store_false', dest='logging', help='Flag to skip logging tests') parser.add_argument('--skip-monitoring-tests', action='store_false', dest='monitoring', help='Flag to skip monitoring tests') parser.add_argument('--skip-exception-tests', action='store_false', dest='exception', help='Flag to skip error reporting tests') parser.add_argument('--url', '-u', help='URL where deployed app is ' + 'exposed (if applicable)') args = parser.parse_args() deploy_url = '' application_url = '' if args.deploy: if args.image is None: logging.error('Please specify base image name.') sys.exit(1) if args.directory is None: logging.error('Please specify at least one application to deploy.') sys.exit(1) logging.debug('Deploying app!') deploy_url = deploy_app(args.image, args.directory) if args.deploy and not deploy_url: logging.info('Defaulting to provided URL parameter.') deploy_url = test_util.get_default_url() if deploy_url and not deploy_url.startswith('https://'): deploy_url = 'https://' + deploy_url application_url = args.url or deploy_url or test_util.get_default_url() return _test_app(application_url, args)
def _main(): logging.getLogger().setLevel(logging.INFO) parser = argparse.ArgumentParser() parser.add_argument('--image', '-i', help='Newly-constructed base ' + 'image to build sample app on') parser.add_argument('--directory', '-d', help='Root directory of sample app') parser.add_argument('--skip-standard-logging-tests', action='store_false', dest='standard_logging', help='Flag to skip standard logging tests') parser.add_argument('--skip-custom-logging-tests', action='store_false', dest='custom_logging', help='Flag to skip custom logging tests') parser.add_argument('--skip-monitoring-tests', action='store_false', dest='monitoring', help='Flag to skip monitoring tests') parser.add_argument('--skip-exception-tests', action='store_false', dest='exception', help='Flag to skip error reporting tests') parser.add_argument('--skip-custom-tests', action='store_false', dest='custom', help='Flag to skip custom integration tests') parser.add_argument('--url', '-u', help='URL where deployed app is ' + 'exposed (if applicable)') parser.add_argument('--verbose', '-v', action='store_true') parser.add_argument('--builder', '-b', help='builder file to template') parser.add_argument('--yaml', '-y', help='optional path to app.yaml file', required=False) parser.add_argument('--environment', '-e', help='environment to deploy sample application ' '(GAE, GKE)', required=False, choices=constants.ENVS, default=constants.GAE) args = parser.parse_args() if args.verbose: logging.getLogger().setLevel(logging.DEBUG) application_url = '' if not args.url: if args.image is None and args.builder is None: logging.error('Please specify base image or builder image name.') sys.exit(1) if args.directory is None: logging.error('Please specify at least one application to deploy.') sys.exit(1) logging.debug('Deploying app to %s', args.environment) try: (version_or_namespace, url) = deploy_app.deploy_app(appdir=args.directory, environment=args.environment, base_image=args.image, builder_image=args.builder, yaml=args.yaml) except Exception as e: logging.error('Application not successfully deployed: %s', e) sys.exit(1) application_url = args.url or url code = _test_app(application_url, args) if not args.url: if args.environment == constants.GAE: deploy_app.stop_version(version_or_namespace) elif args.environment == constants.GKE: deploy_app.stop_deployment(version_or_namespace) return code
def _main(): logging.getLogger().setLevel(logging.INFO) parser = argparse.ArgumentParser() parser.add_argument('--image', '-i', help='Newly-constructed base ' + 'image to build sample app on') parser.add_argument('--directory', '-d', help='Root directory of sample app') parser.add_argument('--skip-standard-logging-tests', action='store_false', dest='standard_logging', help='Flag to skip standard logging tests') parser.add_argument('--skip-custom-logging-tests', action='store_false', dest='custom_logging', help='Flag to skip custom logging tests') parser.add_argument('--skip-monitoring-tests', action='store_false', dest='monitoring', help='Flag to skip monitoring tests') parser.add_argument('--skip-exception-tests', action='store_false', dest='exception', help='Flag to skip error reporting tests') parser.add_argument('--skip-custom-tests', action='store_false', dest='custom', help='Flag to skip custom integration tests') parser.add_argument('--url', '-u', help='URL where deployed app is ' + 'exposed (if applicable)') parser.add_argument('--verbose', '-v', action='store_true') args = parser.parse_args() if args.verbose: logging.getLogger().setLevel(logging.DEBUG) application_url = '' if not args.url: if args.image is None: logging.error('Please specify base image name.') sys.exit(1) if args.directory is None: logging.error('Please specify at least one application to deploy.') sys.exit(1) logging.debug('Deploying app!') version = deploy_app.deploy_app(args.image, args.directory) application_url = args.url or test_util.retrieve_url_for_version(version) code = _test_app(application_url, args) if not args.url: deploy_app.stop_app(version) return code