Better warnings check

This commit is contained in:
Ayaz Salikhov
2022-01-22 19:43:47 +03:00
parent 606ad43920
commit 897b6e0544
2 changed files with 12 additions and 1 deletions

View File

@@ -32,9 +32,15 @@ def test_nbconvert(container: TrackedContainer, test_file: str) -> None:
) )
logs = container.run_and_wait( logs = container.run_and_wait(
timeout=60, timeout=60,
no_warnings=False,
volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}}, volumes={str(host_data_dir): {"bind": cont_data_dir, "mode": "ro"}},
tty=True, tty=True,
command=["start.sh", "bash", "-c", command], command=["start.sh", "bash", "-c", command],
) )
# Spark warning
warnings = TrackedContainer.get_warnings(logs)
assert len(warnings) == 1
assert "An illegal reflective access operation has occurred" in warnings[0]
expected_file = f"{output_dir}/{test_file}.md" expected_file = f"{output_dir}/{test_file}.md"
assert expected_file in logs, f"Expected file {expected_file} not generated" assert expected_file in logs, f"Expected file {expected_file} not generated"

View File

@@ -11,9 +11,14 @@ LOGGER = logging.getLogger(__name__)
def test_spark_shell(container: TrackedContainer) -> None: def test_spark_shell(container: TrackedContainer) -> None:
"""Checking if Spark (spark-shell) is running properly""" """Checking if Spark (spark-shell) is running properly"""
logs = container.run_and_wait( logs = container.run_and_wait(
no_warnings=False, # WARNING: An illegal reflective access operation has occurred
timeout=60, timeout=60,
no_warnings=False,
tty=True, tty=True,
command=["start.sh", "bash", "-c", 'spark-shell <<< "1+1"'], command=["start.sh", "bash", "-c", 'spark-shell <<< "1+1"'],
) )
# Spark warning
warnings = TrackedContainer.get_warnings(logs)
assert len(warnings) == 1
assert "An illegal reflective access operation has occurred" in warnings[0]
assert "res0: Int = 2" in logs, "spark-shell does not work" assert "res0: Int = 2" in logs, "spark-shell does not work"