mirror of
https://github.com/zulip/zulip.git
synced 2025-10-28 18:43:52 +00:00
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:
committed by
Tim Abbott
parent
ca515e5583
commit
911c5f19f1
@@ -16,7 +16,7 @@ def run() -> None:
|
|||||||
|
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
assert_provisioning_status_ok(options.force)
|
assert_provisioning_status_ok(options.skip_provision_check)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -80,20 +80,22 @@ def get_provisioning_status() -> Tuple[bool, Optional[str]]:
|
|||||||
return False, preamble(version) + NEED_TO_UPGRADE
|
return False, preamble(version) + NEED_TO_UPGRADE
|
||||||
|
|
||||||
|
|
||||||
def assert_provisioning_status_ok(force: bool) -> None:
|
def assert_provisioning_status_ok(skip_provision_check: bool) -> None:
|
||||||
if not force:
|
if not skip_provision_check:
|
||||||
ok, msg = get_provisioning_status()
|
ok, msg = get_provisioning_status()
|
||||||
if not ok:
|
if not ok:
|
||||||
print(msg)
|
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)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def add_provision_check_override_param(parser: ArgumentParser) -> None:
|
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]:
|
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
|
@contextmanager
|
||||||
def test_server_running(
|
def test_server_running(
|
||||||
force: bool = False,
|
skip_provision_check: bool = False,
|
||||||
external_host: str = "testserver",
|
external_host: str = "testserver",
|
||||||
log_file: Optional[str] = None,
|
log_file: Optional[str] = None,
|
||||||
dots: bool = False,
|
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 this not through the shell, so that we have the actual PID.
|
||||||
run_dev_server_command = ["tools/run-dev.py", "--test", "--streamlined"]
|
run_dev_server_command = ["tools/run-dev.py", "--test", "--streamlined"]
|
||||||
if force:
|
if skip_provision_check:
|
||||||
run_dev_server_command.append("--force")
|
run_dev_server_command.append("--skip-provision-check")
|
||||||
server = subprocess.Popen(run_dev_server_command, stdout=log, stderr=log)
|
server = subprocess.Popen(run_dev_server_command, stdout=log, stderr=log)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ def run() -> None:
|
|||||||
|
|
||||||
os.chdir(root_dir)
|
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,
|
# Invoke the appropriate lint checker for each language,
|
||||||
# and also check files for extra whitespace.
|
# and also check files for extra whitespace.
|
||||||
@@ -107,8 +107,8 @@ def run() -> None:
|
|||||||
description="Formats shell scripts",
|
description="Formats shell scripts",
|
||||||
)
|
)
|
||||||
command = ["tools/run-mypy", "--quiet"]
|
command = ["tools/run-mypy", "--quiet"]
|
||||||
if args.force:
|
if args.skip_provision_check:
|
||||||
command.append("--force")
|
command.append("--skip-provision-check")
|
||||||
linter_config.external_linter(
|
linter_config.external_linter(
|
||||||
"mypy",
|
"mypy",
|
||||||
command,
|
command,
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ if [ ${#changed_files} -eq 0 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$VIRTUAL_ENV" ] && command -v vagrant >/dev/null && [ -e .vagrant ]; then
|
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..."
|
echo "Running lint using vagrant..."
|
||||||
vagrant ssh -c "$vcmd"
|
vagrant ssh -c "$vcmd"
|
||||||
else
|
else
|
||||||
./tools/lint --skip=gitlint --force "${changed_files[@]}" || true
|
./tools/lint --skip=gitlint --skip-provision-check "${changed_files[@]}" || true
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ parser.add_argument(
|
|||||||
add_provision_check_override_param(parser)
|
add_provision_check_override_param(parser)
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
assert_provisioning_status_ok(options.force)
|
assert_provisioning_status_ok(options.skip_provision_check)
|
||||||
|
|
||||||
if options.interface is None:
|
if options.interface is None:
|
||||||
user_id = os.getuid()
|
user_id = os.getuid()
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ parser.add_argument(
|
|||||||
add_provision_check_override_param(parser)
|
add_provision_check_override_param(parser)
|
||||||
parser.add_argument("--quiet", action="store_true", help="suppress mypy summary output")
|
parser.add_argument("--quiet", action="store_true", help="suppress mypy summary output")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
assert_provisioning_status_ok(args.skip_provision_check)
|
||||||
assert_provisioning_status_ok(args.force)
|
|
||||||
|
|
||||||
command_name = "mypy"
|
command_name = "mypy"
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ eval set -- "$TEMP"
|
|||||||
# extract options.
|
# extract options.
|
||||||
while true; do
|
while true; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-f | --force)
|
-f | --skip-provision-check)
|
||||||
FORCEARG="--force"
|
FORCEARG="--skip-provision-check"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
--)
|
--)
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ parser = argparse.ArgumentParser(usage)
|
|||||||
add_provision_check_override_param(parser)
|
add_provision_check_override_param(parser)
|
||||||
options = parser.parse_args()
|
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
|
# Zerver imports should happen after `django.setup()` is run
|
||||||
# by the test_server_running decorator.
|
# by the test_server_running decorator.
|
||||||
from zerver.lib.actions import do_create_user
|
from zerver.lib.actions import do_create_user
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ def main() -> None:
|
|||||||
full_suite = False
|
full_suite = False
|
||||||
os.environ["GENERATE_STRIPE_FIXTURES"] = "1"
|
os.environ["GENERATE_STRIPE_FIXTURES"] = "1"
|
||||||
|
|
||||||
assert_provisioning_status_ok(options.force)
|
assert_provisioning_status_ok(options.skip_provision_check)
|
||||||
|
|
||||||
if options.coverage:
|
if options.coverage:
|
||||||
import coverage
|
import coverage
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ def vnu_servlet() -> Iterator[None]:
|
|||||||
proc.terminate()
|
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(
|
ret_help_doc = subprocess.call(
|
||||||
["scrapy", "crawl_with_status", *extra_args, "help_documentation_crawler"],
|
["scrapy", "crawl_with_status", *extra_args, "help_documentation_crawler"],
|
||||||
cwd="tools/documentation_crawler",
|
cwd="tools/documentation_crawler",
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ parser.add_argument("args", nargs=argparse.REMAINDER)
|
|||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
individual_files = options.args
|
individual_files = options.args
|
||||||
|
|
||||||
assert_provisioning_status_ok(options.force)
|
assert_provisioning_status_ok(options.skip_provision_check)
|
||||||
|
|
||||||
|
|
||||||
def get_dev_host() -> str:
|
def get_dev_host() -> str:
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ or report and ask for help in chat.zulip.org""",
|
|||||||
|
|
||||||
|
|
||||||
external_host = "zulipdev.com:9981"
|
external_host = "zulipdev.com:9981"
|
||||||
assert_provisioning_status_ok(options.force)
|
assert_provisioning_status_ok(options.skip_provision_check)
|
||||||
prepare_puppeteer_run()
|
prepare_puppeteer_run()
|
||||||
run_tests(options.tests, external_host)
|
run_tests(options.tests, external_host)
|
||||||
print(f"{OKGREEN}All tests passed!{ENDC}")
|
print(f"{OKGREEN}All tests passed!{ENDC}")
|
||||||
|
|||||||
Reference in New Issue
Block a user