mirror of https://github.com/zulip/zulip.git
tools: Rename force argument to skip-provision-check
This commit renames --force argument used with various tests to --skip-provision-check. As a consequence of this name change all other files that set --force option for the test commands have been updated. This change is done in order to provide more clarity for using this option for runnning tests. This commit addresses issue #17455.
This commit is contained in:
parent
ca515e5583
commit
911c5f19f1
|
@ -16,7 +16,7 @@ def run() -> None:
|
|||
|
||||
options = parser.parse_args()
|
||||
|
||||
assert_provisioning_status_ok(options.force)
|
||||
assert_provisioning_status_ok(options.skip_provision_check)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -80,20 +80,22 @@ def get_provisioning_status() -> Tuple[bool, Optional[str]]:
|
|||
return False, preamble(version) + NEED_TO_UPGRADE
|
||||
|
||||
|
||||
def assert_provisioning_status_ok(force: bool) -> None:
|
||||
if not force:
|
||||
def assert_provisioning_status_ok(skip_provision_check: bool) -> None:
|
||||
if not skip_provision_check:
|
||||
ok, msg = get_provisioning_status()
|
||||
if not ok:
|
||||
print(msg)
|
||||
print("If you really know what you are doing, use --force to run anyway.")
|
||||
print(
|
||||
"If you really know what you are doing, use --skip-provision-check to run anyway."
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def add_provision_check_override_param(parser: ArgumentParser) -> None:
|
||||
"""
|
||||
Registers --force argument to be used with various commands/tests in our tools.
|
||||
Registers --skip-provision-check argument to be used with various commands/tests in our tools.
|
||||
"""
|
||||
parser.add_argument("--force", action="store_true", help="Run tests despite possible problems.")
|
||||
parser.add_argument("--skip-provision-check", action="store_true", help="Run tests despite possible problems.")
|
||||
|
||||
|
||||
def find_js_test_files(test_dir: str, files: Iterable[str]) -> List[str]:
|
||||
|
|
|
@ -53,7 +53,7 @@ def server_is_up(server: "subprocess.Popen[bytes]", log_file: Optional[str]) ->
|
|||
|
||||
@contextmanager
|
||||
def test_server_running(
|
||||
force: bool = False,
|
||||
skip_provision_check: bool = False,
|
||||
external_host: str = "testserver",
|
||||
log_file: Optional[str] = None,
|
||||
dots: bool = False,
|
||||
|
@ -72,8 +72,8 @@ def test_server_running(
|
|||
|
||||
# Run this not through the shell, so that we have the actual PID.
|
||||
run_dev_server_command = ["tools/run-dev.py", "--test", "--streamlined"]
|
||||
if force:
|
||||
run_dev_server_command.append("--force")
|
||||
if skip_provision_check:
|
||||
run_dev_server_command.append("--skip-provision-check")
|
||||
server = subprocess.Popen(run_dev_server_command, stdout=log, stderr=log)
|
||||
|
||||
try:
|
||||
|
|
|
@ -36,7 +36,7 @@ def run() -> None:
|
|||
|
||||
os.chdir(root_dir)
|
||||
|
||||
assert_provisioning_status_ok(args.force)
|
||||
assert_provisioning_status_ok(args.skip_provision_check)
|
||||
|
||||
# Invoke the appropriate lint checker for each language,
|
||||
# and also check files for extra whitespace.
|
||||
|
@ -107,8 +107,8 @@ def run() -> None:
|
|||
description="Formats shell scripts",
|
||||
)
|
||||
command = ["tools/run-mypy", "--quiet"]
|
||||
if args.force:
|
||||
command.append("--force")
|
||||
if args.skip_provision_check:
|
||||
command.append("--skip-provision-check")
|
||||
linter_config.external_linter(
|
||||
"mypy",
|
||||
command,
|
||||
|
|
|
@ -19,10 +19,10 @@ if [ ${#changed_files} -eq 0 ]; then
|
|||
fi
|
||||
|
||||
if [ -z "$VIRTUAL_ENV" ] && command -v vagrant >/dev/null && [ -e .vagrant ]; then
|
||||
vcmd="/srv/zulip/tools/lint --skip=gitlint --force $(printf '%q ' "${changed_files[@]}") || true"
|
||||
vcmd="/srv/zulip/tools/lint --skip=gitlint --skip-provision-check $(printf '%q ' "${changed_files[@]}") || true"
|
||||
echo "Running lint using vagrant..."
|
||||
vagrant ssh -c "$vcmd"
|
||||
else
|
||||
./tools/lint --skip=gitlint --force "${changed_files[@]}" || true
|
||||
./tools/lint --skip=gitlint --skip-provision-check "${changed_files[@]}" || true
|
||||
fi
|
||||
exit 0
|
||||
|
|
|
@ -59,7 +59,7 @@ parser.add_argument(
|
|||
add_provision_check_override_param(parser)
|
||||
options = parser.parse_args()
|
||||
|
||||
assert_provisioning_status_ok(options.force)
|
||||
assert_provisioning_status_ok(options.skip_provision_check)
|
||||
|
||||
if options.interface is None:
|
||||
user_id = os.getuid()
|
||||
|
|
|
@ -30,8 +30,7 @@ parser.add_argument(
|
|||
add_provision_check_override_param(parser)
|
||||
parser.add_argument("--quiet", action="store_true", help="suppress mypy summary output")
|
||||
args = parser.parse_args()
|
||||
|
||||
assert_provisioning_status_ok(args.force)
|
||||
assert_provisioning_status_ok(args.skip_provision_check)
|
||||
|
||||
command_name = "mypy"
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ eval set -- "$TEMP"
|
|||
# extract options.
|
||||
while true; do
|
||||
case "$1" in
|
||||
-f | --force)
|
||||
FORCEARG="--force"
|
||||
-f | --skip-provision-check)
|
||||
FORCEARG="--skip-provision-check"
|
||||
shift
|
||||
;;
|
||||
--)
|
||||
|
|
|
@ -24,9 +24,11 @@ parser = argparse.ArgumentParser(usage)
|
|||
add_provision_check_override_param(parser)
|
||||
options = parser.parse_args()
|
||||
|
||||
assert_provisioning_status_ok(options.force)
|
||||
assert_provisioning_status_ok(options.skip_provision_check)
|
||||
|
||||
with test_server_running(force=options.force, external_host="zulipdev.com:9981"):
|
||||
with test_server_running(
|
||||
skip_provision_check=options.skip_provision_check, external_host="zulipdev.com:9981"
|
||||
):
|
||||
# Zerver imports should happen after `django.setup()` is run
|
||||
# by the test_server_running decorator.
|
||||
from zerver.lib.actions import do_create_user
|
||||
|
|
|
@ -368,7 +368,7 @@ def main() -> None:
|
|||
full_suite = False
|
||||
os.environ["GENERATE_STRIPE_FIXTURES"] = "1"
|
||||
|
||||
assert_provisioning_status_ok(options.force)
|
||||
assert_provisioning_status_ok(options.skip_provision_check)
|
||||
|
||||
if options.coverage:
|
||||
import coverage
|
||||
|
|
|
@ -60,7 +60,9 @@ def vnu_servlet() -> Iterator[None]:
|
|||
proc.terminate()
|
||||
|
||||
|
||||
with vnu_servlet(), test_server_running(options.force, external_host, log_file=LOG_FILE, dots=True):
|
||||
with vnu_servlet(), test_server_running(
|
||||
options.skip_provision_check, external_host, log_file=LOG_FILE, dots=True
|
||||
):
|
||||
ret_help_doc = subprocess.call(
|
||||
["scrapy", "crawl_with_status", *extra_args, "help_documentation_crawler"],
|
||||
cwd="tools/documentation_crawler",
|
||||
|
|
|
@ -176,7 +176,7 @@ parser.add_argument("args", nargs=argparse.REMAINDER)
|
|||
options = parser.parse_args()
|
||||
individual_files = options.args
|
||||
|
||||
assert_provisioning_status_ok(options.force)
|
||||
assert_provisioning_status_ok(options.skip_provision_check)
|
||||
|
||||
|
||||
def get_dev_host() -> str:
|
||||
|
|
|
@ -122,7 +122,7 @@ or report and ask for help in chat.zulip.org""",
|
|||
|
||||
|
||||
external_host = "zulipdev.com:9981"
|
||||
assert_provisioning_status_ok(options.force)
|
||||
assert_provisioning_status_ok(options.skip_provision_check)
|
||||
prepare_puppeteer_run()
|
||||
run_tests(options.tests, external_host)
|
||||
print(f"{OKGREEN}All tests passed!{ENDC}")
|
||||
|
|
Loading…
Reference in New Issue