diff --git a/test/test_artifacts/v2/fastapi.test.Dockerfile b/test/test_artifacts/v2/fastapi.test.Dockerfile new file mode 100644 index 00000000..5a54c11b --- /dev/null +++ b/test/test_artifacts/v2/fastapi.test.Dockerfile @@ -0,0 +1,17 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/fastapi/fastapi + +WORKDIR "fastapi" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_fastapi_tests.sh . + +RUN chmod +x run_fastapi_tests.sh + +CMD ["./run_fastapi_tests.sh"] + diff --git a/test/test_artifacts/v2/ipywidgets.test.Dockerfile b/test/test_artifacts/v2/ipywidgets.test.Dockerfile new file mode 100644 index 00000000..c2d3235a --- /dev/null +++ b/test/test_artifacts/v2/ipywidgets.test.Dockerfile @@ -0,0 +1,20 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git + +RUN git clone https://github.com/jupyter-widgets/ipywidgets.git + +WORKDIR "ipywidgets" + +RUN pip install jupyter nbconvert + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_ipywidgets_tests.sh ./ +RUN chmod +x run_ipywidgets_tests.sh + +CMD ["./run_ipywidgets_tests.sh"] diff --git a/test/test_artifacts/v2/jinja2.test.Dockerfile b/test/test_artifacts/v2/jinja2.test.Dockerfile new file mode 100644 index 00000000..be28d8f0 --- /dev/null +++ b/test/test_artifacts/v2/jinja2.test.Dockerfile @@ -0,0 +1,14 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN micromamba install -y -c conda-forge jinja2 + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jinja2_tests.sh ./ + +RUN chmod +x run_jinja2_tests.sh + +CMD ["./run_jinja2_tests.sh"] diff --git a/test/test_artifacts/v2/jupyter-collaboration.test.Dockerfile b/test/test_artifacts/v2/jupyter-collaboration.test.Dockerfile index 0b005de1..a4ed91e4 100644 --- a/test/test_artifacts/v2/jupyter-collaboration.test.Dockerfile +++ b/test/test_artifacts/v2/jupyter-collaboration.test.Dockerfile @@ -3,4 +3,15 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -CMD ["python", "-c", "import jupyter_collaboration; import jupyter_server_fileid; from jupyter_ydoc import YBlob; yblob = YBlob(); assert yblob.get() == b''; yblob.set(b'012'); assert yblob.get() == b'012'"] +RUN sudo apt-get update && \ + sudo apt-get install -y git + +RUN git clone --recursive https://github.com/jupyterlab/jupyter-collaboration.git + +WORKDIR "jupyter-collaboration" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyter_collaboration_tests.sh . + +RUN chmod +x run_jupyter_collaboration_tests.sh + +CMD ["./run_jupyter_collaboration_tests.sh"] diff --git a/test/test_artifacts/v2/jupyter-scheduler.test.Dockerfile b/test/test_artifacts/v2/jupyter-scheduler.test.Dockerfile new file mode 100644 index 00000000..0487bfa2 --- /dev/null +++ b/test/test_artifacts/v2/jupyter-scheduler.test.Dockerfile @@ -0,0 +1,17 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/jupyter-server/jupyter-scheduler + +WORKDIR "jupyter-scheduler" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyter_scheduler_tests.sh . + +RUN chmod +x run_jupyter_scheduler_tests.sh + +CMD ["./run_jupyter_scheduler_tests.sh"] + diff --git a/test/test_artifacts/v2/jupyter-server-proxy.test.Dockerfile b/test/test_artifacts/v2/jupyter-server-proxy.test.Dockerfile new file mode 100644 index 00000000..f7e44e17 --- /dev/null +++ b/test/test_artifacts/v2/jupyter-server-proxy.test.Dockerfile @@ -0,0 +1,16 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/jupyterhub/jupyter-server-proxy.git + +WORKDIR "jupyter-server-proxy" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyter_server_proxy_tests.sh . + +RUN chmod +x run_jupyter_server_proxy_tests.sh + +CMD ["./run_jupyter_server_proxy_tests.sh"] diff --git a/test/test_artifacts/v2/jupyterlab-git.test.Dockerfile b/test/test_artifacts/v2/jupyterlab-git.test.Dockerfile index 7d5cbd96..3b9faf86 100644 --- a/test/test_artifacts/v2/jupyterlab-git.test.Dockerfile +++ b/test/test_artifacts/v2/jupyterlab-git.test.Dockerfile @@ -3,4 +3,16 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -CMD ["python", "-c", "import jupyterlab_git"] +RUN sudo apt-get update && \ + sudo apt-get install -y git + +RUN git clone --recursive https://github.com/jupyterlab/jupyterlab-git + +WORKDIR "jupyterlab-git" + +RUN micromamba install --freeze-installed -y -c conda-forge pytest + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyterlab_git_tests.sh . +RUN chmod +x run_jupyterlab_git_tests.sh + +CMD ["./run_jupyterlab_git_tests.sh"] diff --git a/test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile b/test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile index c13df62a..21d66a8b 100644 --- a/test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile +++ b/test/test_artifacts/v2/jupyterlab-lsp.test.Dockerfile @@ -3,5 +3,8 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -CMD ["python", "-c", "import jupyter_lsp"] -CMD ["python", "-c", "import jupyterlab_lsp"] +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_jupyterlab_lsp_tests.sh ./ +RUN chmod +x run_jupyterlab_lsp_tests.sh + +CMD ["./run_jupyterlab_lsp_tests.sh"] + diff --git a/test/test_artifacts/v2/langchain-aws.test.Dockerfile b/test/test_artifacts/v2/langchain-aws.test.Dockerfile deleted file mode 100644 index 73353bb0..00000000 --- a/test/test_artifacts/v2/langchain-aws.test.Dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -ARG SAGEMAKER_DISTRIBUTION_IMAGE -FROM $SAGEMAKER_DISTRIBUTION_IMAGE - -ARG MAMBA_DOCKERFILE_ACTIVATE=1 - -CMD ["python", "-c", "import langchain_aws"] -CMD ["python", "-c", "from langchain_aws import BedrockLLM"] -CMD ["python", "-c", "from langchain_aws import ChatBedrock"] -CMD ["python", "-c", "from langchain_aws import SagemakerEndpoint"] -CMD ["python", "-c", "from langchain_aws import AmazonKendraRetriever"] -CMD ["python", "-c", "from langchain_aws import AmazonKnowledgeBasesRetriever"] -CMD ["python", "-c", "from langchain_aws import NeptuneAnalyticsGraph"] -CMD ["python", "-c", "from langchain_aws import NeptuneGraph"] diff --git a/test/test_artifacts/v2/langchain.test.Dockerfile b/test/test_artifacts/v2/langchain.test.Dockerfile new file mode 100644 index 00000000..80309ab1 --- /dev/null +++ b/test/test_artifacts/v2/langchain.test.Dockerfile @@ -0,0 +1,28 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN micromamba install -y -c conda-forge pytest + +# Create the test script +RUN echo '#!/bin/bash' > /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'set -e' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'echo "Langchain version: $(python -c "import langchain; print(langchain.__version__)")"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'langchain_path=$(python -c "import langchain; import os; print(os.path.dirname(langchain.__file__))")' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'test_path="${langchain_path}/tests/unit_tests"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'if [ -d "$test_path" ]; then' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo ' pytest "$test_path" -v' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'else' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo ' echo "Unit tests directory not found at $test_path"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo ' echo "Available files in langchain directory:"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo ' find "$langchain_path" -name "*.py"' >> /home/sagemaker-user/run_langchain_tests.sh && \ + echo 'fi' >> /home/sagemaker-user/run_langchain_tests.sh + +RUN chmod +x /home/sagemaker-user/run_langchain_tests.sh + +WORKDIR /home/sagemaker-user + +CMD ["./run_langchain_tests.sh"] \ No newline at end of file diff --git a/test/test_artifacts/v2/notebook.test.Dockerfile b/test/test_artifacts/v2/notebook.test.Dockerfile index 9afb9e08..f0bb8576 100644 --- a/test/test_artifacts/v2/notebook.test.Dockerfile +++ b/test/test_artifacts/v2/notebook.test.Dockerfile @@ -3,4 +3,15 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -CMD ["python", "-c", "import notebook"] +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/jupyter/notebook + +WORKDIR "notebook" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_notebook_tests.sh . + +RUN chmod +x run_notebook_tests.sh + +CMD ["./run_notebook_tests.sh"] + diff --git a/test/test_artifacts/v2/pyhive.test.Dockerfile b/test/test_artifacts/v2/pyhive.test.Dockerfile new file mode 100644 index 00000000..8259c098 --- /dev/null +++ b/test/test_artifacts/v2/pyhive.test.Dockerfile @@ -0,0 +1,17 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/dropbox/PyHive.git + +WORKDIR "PyHive" + +RUN micromamba install --freeze-installed -y -c conda-forge pytest + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_pyhive_tests.sh . +RUN chmod +x run_pyhive_tests.sh + +CMD ["./run_pyhive_tests.sh"] diff --git a/test/test_artifacts/v2/python-lsp-server.test.Dockerfile b/test/test_artifacts/v2/python-lsp-server.test.Dockerfile index eb73f0e0..3d1946d5 100644 --- a/test/test_artifacts/v2/python-lsp-server.test.Dockerfile +++ b/test/test_artifacts/v2/python-lsp-server.test.Dockerfile @@ -3,5 +3,12 @@ FROM $SAGEMAKER_DISTRIBUTION_IMAGE ARG MAMBA_DOCKERFILE_ACTIVATE=1 -# "Confirm that installation succeeded" by running this - https://github.com/python-lsp/python-lsp-server#installation -CMD ["pylsp", "--help"] +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/python-lsp/python-lsp-server + +WORKDIR "python-lsp" + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_python_lsp_server_tests.sh . + +RUN chmod +x run_python_lsp_server_tests.sh diff --git a/test/test_artifacts/v2/run_pandas_tests.py b/test/test_artifacts/v2/run_pandas_tests.py index a286443f..ee6dc383 100644 --- a/test/test_artifacts/v2/run_pandas_tests.py +++ b/test/test_artifacts/v2/run_pandas_tests.py @@ -24,7 +24,9 @@ "-m", "(not slow and not network and not db and not clipboard)", "-k", - "(not test_network and not s3 and not test_plain_axes)", + "(not test_network and not s3 and not test_plain_axes and not test_xsqlite_execute_closed_connection and not test_sql)", + "-W", + "ignore::PendingDeprecationWarning", "--no-strict-data-files", "--ignore", "pandas/tests/frame/test_arithmetic.py::TestFrameFlexArithmetic::test_floordiv_axis0_numexpr_path", diff --git a/test/test_artifacts/v2/s3fs.test.Dockerfile b/test/test_artifacts/v2/s3fs.test.Dockerfile index 8f3a0c68..5e182ad1 100644 --- a/test/test_artifacts/v2/s3fs.test.Dockerfile +++ b/test/test_artifacts/v2/s3fs.test.Dockerfile @@ -5,6 +5,7 @@ ARG MAMBA_DOCKERFILE_ACTIVATE=1 RUN git clone --recursive https://github.com/fsspec/s3fs.git WORKDIR "s3fs" + COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_s3fs_tests.sh . RUN chmod +x run_s3fs_tests.sh CMD ["./run_s3fs_tests.sh"] diff --git a/test/test_artifacts/v2/scikit-learn.test.Dockerfile b/test/test_artifacts/v2/scikit-learn.test.Dockerfile new file mode 100644 index 00000000..bb4e6a28 --- /dev/null +++ b/test/test_artifacts/v2/scikit-learn.test.Dockerfile @@ -0,0 +1,23 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN micromamba install -y --name base -c conda-forge pytest pytest-cov + +RUN echo '#!/bin/bash' > /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'import_path=$(python -c "import sklearn; print(sklearn.__file__)")' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'sklearn_path=$(dirname "$import_path")' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'test_files=("test_base.py" "test_init.py")' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'for test_file in "${test_files[@]}"; do' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo ' echo "Running tests in $test_file"' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo ' pytest -v "$sklearn_path/tests/$test_file"' >> /home/sagemaker-user/run_scikit_learn_tests.sh && \ + echo 'done' >> /home/sagemaker-user/run_scikit_learn_tests.sh + +RUN chmod +x /home/sagemaker-user/run_scikit_learn_tests.sh + +WORKDIR /home/sagemaker-user + +CMD ["./run_scikit_learn_tests.sh"] \ No newline at end of file diff --git a/test/test_artifacts/v2/scripts/run_fastapi_tests.sh b/test/test_artifacts/v2/scripts/run_fastapi_tests.sh new file mode 100644 index 00000000..960ebf8f --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_fastapi_tests.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +fastapi_version=$(micromamba list | grep fastapi | tr -s ' ' | cut -d ' ' -f 3) + +git checkout tags/v$fastapi_version + +pip install -r requirements-tests.txt + +pytest tests/ -v -k "not test_tutorial" diff --git a/test/test_artifacts/v2/scripts/run_ipywidgets_tests.sh b/test/test_artifacts/v2/scripts/run_ipywidgets_tests.sh new file mode 100644 index 00000000..ba7afda2 --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_ipywidgets_tests.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +jupyter nbconvert --execute --to python tests/test_borders.ipynb +jupyter nbconvert --execute --to python tests/test_sanitizer.ipynb diff --git a/test/test_artifacts/v2/scripts/run_jinja2_tests.sh b/test/test_artifacts/v2/scripts/run_jinja2_tests.sh new file mode 100644 index 00000000..e0cefa8a --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_jinja2_tests.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +set -e + +# Test 1: Basic template +python -c " +from jinja2 import Template +template = Template('Hello {{ name }}!') +result = template.render(name='John') +assert result == 'Hello John!', f'Expected \"Hello John!\", got \"{result}\"' +" + +# Test 2: Conditional statements +python -c " +from jinja2 import Template +template = Template('{% if user %}Hello, {{ user }}!{% else %}Hello, stranger!{% endif %}') +result1 = template.render(user='Alice') +result2 = template.render(user=None) +assert result1 == 'Hello, Alice!', f'Expected \"Hello, Alice!\", got \"{result1}\"' +assert result2 == 'Hello, stranger!', f'Expected \"Hello, stranger!\", got \"{result2}\"' +" + +# Test 3: Loops +python -c " +from jinja2 import Template +template = Template('{% for item in items %}{{ item }} {% endfor %}') +result = template.render(items=['apple', 'banana', 'cherry']) +assert result == 'apple banana cherry ', f'Expected \"apple banana cherry \", got \"{result}\"' +" + +# Test 4: Filters +python -c " +from jinja2 import Template +template = Template('{{ name|upper }}') +result = template.render(name='john') +assert result == 'JOHN', f'Expected \"JOHN\", got \"{result}\"' +" + +# Test 5: File system loader +echo "

Hello, {{ name }}!

" > /tmp/test_template.html +python -c " +from jinja2 import Environment, FileSystemLoader +import os +env = Environment(loader=FileSystemLoader('/tmp')) +template = env.get_template('test_template.html') +result = template.render(name='World') +assert result == '

Hello, World!

', f'Expected \"

Hello, World!

\", got \"{result}\"' +" +rm /tmp/test_template.html + +python -c " +from jinja2 import Template, TemplateSyntaxError +try: + Template('{% if %}') + assert False, 'Should have raised TemplateSyntaxError' +except TemplateSyntaxError: + print('Error handling test passed.') +" + +# Test 7: Template inheritance +# base template +echo "{% block content %}Default content{% endblock %}" > /tmp/base.html +# child template +echo "{% extends 'base.html' %}{% block content %}Child content{% endblock %}" > /tmp/child.html + +python -c " +from jinja2 import Environment, FileSystemLoader +env = Environment(loader=FileSystemLoader('/tmp')) +template = env.get_template('child.html') +result = template.render() +assert result == 'Child content', f'Expected \"Child content\", got \"{result}\"' +" + +rm /tmp/base.html /tmp/child.html diff --git a/test/test_artifacts/v2/scripts/run_jupyter_collaboration_tests.sh b/test/test_artifacts/v2/scripts/run_jupyter_collaboration_tests.sh new file mode 100644 index 00000000..9775ffc8 --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_jupyter_collaboration_tests.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +pip install ".[test]" + +pytest tests/ -v diff --git a/test/test_artifacts/v2/scripts/run_jupyter_scheduler_tests.sh b/test/test_artifacts/v2/scripts/run_jupyter_scheduler_tests.sh new file mode 100644 index 00000000..7aa3b1c2 --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_jupyter_scheduler_tests.sh @@ -0,0 +1,20 @@ +#!/bin/bash +jupyter_scheduler_version=$(micromamba list | grep jupyter-scheduler | tr -s ' ' | cut -d ' ' -f 3) + +git checkout tags/v$jupyter_scheduler_version + + +pip install ".[test]" + +test_files=( + "jupyter_scheduler/tests/test_execution_manager.py" + "jupyter_scheduler/tests/test_handlers.py" + "jupyter_scheduler/tests/test_job_files_manager.py" + "jupyter_scheduler/tests/test_orm.py" + "jupyter_scheduler/tests/test_scheduler.py" +) + +for test_file in "${test_files[@]}"; do + echo "Running tests in $test_file" + pytest -v "$test_file" +done \ No newline at end of file diff --git a/test/test_artifacts/v2/scripts/run_jupyter_server_proxy_tests.sh b/test/test_artifacts/v2/scripts/run_jupyter_server_proxy_tests.sh new file mode 100644 index 00000000..7e76ab57 --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_jupyter_server_proxy_tests.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +jupyter_server_proxy_version=$(micromamba list | grep jupyter-server-proxy | tr -s ' ' | cut -d ' ' -f 3) + +git checkout tags/v$jupyter_server_proxy_version + +pip install ".[test]" + +test_files=( + "tests/test_config.py" + "tests/test_proxies.py" + "tests/test_utils.py" +) + +# Run each test file +for test_file in "${test_files[@]}"; do + pytest -v "$test_file" +done diff --git a/test/test_artifacts/v2/scripts/run_jupyterlab_git_tests.sh b/test/test_artifacts/v2/scripts/run_jupyterlab_git_tests.sh new file mode 100644 index 00000000..7022affe --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_jupyterlab_git_tests.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +jupyter_git_version=$(micromamba list | grep jupyter-git | tr -s ' ' | cut -d ' ' -f 3) + +git checkout tags/v$jupyter_git_version + +pip install ".[test]" + +pytest -v jupyterlab_git/tests/ diff --git a/test/test_artifacts/v2/scripts/run_jupyterlab_lsp_tests.sh b/test/test_artifacts/v2/scripts/run_jupyterlab_lsp_tests.sh new file mode 100644 index 00000000..b7f5d652 --- /dev/null +++ b/test/test_artifacts/v2/scripts/run_jupyterlab_lsp_tests.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +#imports test +python -c "import jupyter_lsp" || { echo "jupyter_lsp import test failed"; exit 1; } +python -c "import jupyterlab_lsp" || { echo "jupyterlab_lsp import test failed"; exit 1; } + +TEST_DIR=$(mktemp -d) +cd "$TEST_DIR" + +python - < test.py +def hello_world(): + print("Hello, World!") + return None +EOF + +# LSP functionality with the created file +python - < /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'set -e' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'import_path=$(python -c "import tf_keras; print(tf_keras.__file__)")' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'tf_keras_path=$(dirname "$import_path")' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'echo "tf-keras path: $tf_keras_path"' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'test_file="keras_doctest.py"' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'test_path=$(find "$tf_keras_path" -name "$test_file" -print -quit)' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'if [ -n "$test_path" ]; then' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo ' echo "Running test: $test_path"' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo ' pytest -v "$test_path"' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'else' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo ' echo "Test file not found: $test_file"' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo ' echo "Available files in tf_keras:"' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo ' find "$tf_keras_path" -name "*.py"' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo ' exit 1' >> /home/sagemaker-user/run_tf_keras_tests.sh && \ + echo 'fi' >> /home/sagemaker-user/run_tf_keras_tests.sh + +RUN chmod +x /home/sagemaker-user/run_tf_keras_tests.sh + +WORKDIR /home/sagemaker-user + +CMD ["./run_tf_keras_tests.sh"] \ No newline at end of file diff --git a/test/test_artifacts/v2/torchvision.test.Dockerfile b/test/test_artifacts/v2/torchvision.test.Dockerfile new file mode 100644 index 00000000..ccde14fd --- /dev/null +++ b/test/test_artifacts/v2/torchvision.test.Dockerfile @@ -0,0 +1,19 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/pytorch/vision + +WORKDIR "vision" + +RUN micromamba install -y -c conda-forge pytest + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_torchvision_tests.sh . +RUN chmod +x run_torchvision_tests.sh +CMD ["./run_torchvision_tests.sh"] + diff --git a/test/test_artifacts/v2/uvicorn.test.Dockerfile b/test/test_artifacts/v2/uvicorn.test.Dockerfile new file mode 100644 index 00000000..409c3bf0 --- /dev/null +++ b/test/test_artifacts/v2/uvicorn.test.Dockerfile @@ -0,0 +1,19 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/encode/uvicorn + +WORKDIR "uvicorn" + +RUN micromamba install --freeze-installed -y -c conda-forge pytest + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_uvicorn_tests.sh . + +RUN chmod +x run_uvicorn_tests.sh + +CMD ["./run_uvicorn_tests.sh"] + diff --git a/test/test_artifacts/v2/xgboost-cpu.test.Dockerfile b/test/test_artifacts/v2/xgboost-cpu.test.Dockerfile new file mode 100644 index 00000000..2b5cb01c --- /dev/null +++ b/test/test_artifacts/v2/xgboost-cpu.test.Dockerfile @@ -0,0 +1,19 @@ +ARG SAGEMAKER_DISTRIBUTION_IMAGE +FROM $SAGEMAKER_DISTRIBUTION_IMAGE + +ARG MAMBA_DOCKERFILE_ACTIVATE=1 + +ENV OPENBLAS_NUM_THREADS=1 + +RUN sudo apt-get update && \ + sudo apt-get install -y git && \ + git clone --recursive https://github.com/dmlc/xgboost + +WORKDIR "xgboost" + +RUN micromamba install --freeze-installed -y -c conda-forge xgboost hypothesis loky pytest pytest-timeout + +COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_xgboost_cpu_tests.sh . +RUN chmod +x run_xgboost_cpu_tests.sh + +CMD ["./run_xgboost_cpu_tests.sh"] diff --git a/test/test_dockerfile_based_harness.py b/test/test_dockerfile_based_harness.py index 4711dd58..c03e3fdf 100644 --- a/test/test_dockerfile_based_harness.py +++ b/test/test_dockerfile_based_harness.py @@ -37,7 +37,7 @@ ("jupyter-collaboration.test.Dockerfile", ["jupyter-collaboration"]), ("jupyter-dash.test.Dockerfile", ["jupyter-dash"]), ("jupyterlab-lsp.test.Dockerfile", ["jupyterlab-lsp"]), - ("python-lsp-server.test.Dockerfile", ["jupyter-lsp-server"]), + ("python-lsp-server.test.Dockerfile", ["python-lsp-server"]), ("sagemaker-code-editor.test.Dockerfile", ["sagemaker-code-editor"]), ("notebook.test.Dockerfile", ["notebook"]), ("glue-sessions.test.Dockerfile", ["aws-glue-sessions"]), @@ -56,7 +56,7 @@ "amazon_sagemaker_sql_editor.test.Dockerfile", ["amazon_sagemaker_sql_editor"], ), - ("serve.test.Dockerfile", ["langchain"]), + ("langchain.test.Dockerfile", ["langchain"]), ("langchain-aws.test.Dockerfile", ["langchain-aws"]), ("mlflow.test.Dockerfile", ["mlflow"]), ( @@ -67,8 +67,15 @@ ("s3fs.test.Dockerfile", ["s3fs"]), ("seaborn.test.Dockerfile", ["seaborn"]), ("sagemaker-recovery-mode.test.Dockerfile", ["sagemaker-jupyterlab-extension"]), - ("s3fs.test.Dockerfile", ["s3fs"]), - ("seaborn.test.Dockerfile", ["seaborn"]), + ("jinja2.test.Dockerfile", ["jinja2"]), + ("uvicorn.test.Dockerfile", ["uvicorn"]), + ("fastapi.test.Dockerfile", ["fastapi"]), + ("scikit-learn.test.Dockerfile", ["scikit-learn"]), + ("jupyter-scheduler.test.Dockerfile", ["jupyter-scheduler"]), + ("jupyter-server-proxy.test.Dockerfile", ["jupyter-server-proxy"]), + ("ipywidgets.test.Dockerfile", ["ipywidgets"]), + ("supervisor.test.Dockerfile", ["supervisor"]), + ("xgboost-cpu.test.Dockerfile",["xgboost"]), ], ) def test_dockerfiles_for_cpu( @@ -100,10 +107,11 @@ def test_dockerfiles_for_cpu( ("pytorch.examples.Dockerfile", ["pytorch"]), ("tensorflow.examples.Dockerfile", ["tensorflow"]), ("glue-sessions.test.Dockerfile", ["aws-glue-sessions"]), + ("scikit-learn.test.Dockerfile", ["scikit-learn"]), ("jupyter-ai.test.Dockerfile", ["jupyter-ai"]), ("jupyter-dash.test.Dockerfile", ["jupyter-dash"]), ("jupyterlab-lsp.test.Dockerfile", ["jupyterlab-lsp"]), - ("python-lsp-server.test.Dockerfile", ["jupyter-lsp-server"]), + ("python-lsp-server.test.Dockerfile", ["python-lsp-server"]), ("sagemaker-code-editor.test.Dockerfile", ["sagemaker-code-editor"]), ("notebook.test.Dockerfile", ["notebook"]), ("glue-sessions.test.Dockerfile", ["aws-glue-sessions"]), @@ -122,7 +130,7 @@ def test_dockerfiles_for_cpu( "amazon_sagemaker_sql_editor.test.Dockerfile", ["amazon_sagemaker_sql_editor"], ), - ("serve.test.Dockerfile", ["langchain"]), + ("langchain.test.Dockerfile", ["langchain"]), ("langchain-aws.test.Dockerfile", ["langchain-aws"]), ("mlflow.test.Dockerfile", ["mlflow"]), ("sagemaker-mlflow.test.Dockerfile", ["sagemaker-mlflow"]), @@ -135,8 +143,19 @@ def test_dockerfiles_for_cpu( ("s3fs.test.Dockerfile", ["s3fs"]), ("seaborn.test.Dockerfile", ["seaborn"]), ("sagemaker-recovery-mode.test.Dockerfile", ["sagemaker-jupyterlab-extension"]), - ("s3fs.test.Dockerfile", ["s3fs"]), ("seaborn.test.Dockerfile", ["seaborn"]), + ("jinja2.test.Dockerfile", ["jinja2"]), + ("uvicorn.test.Dockerfile", ["uvicorn"]), + ("fastapi.test.Dockerfile", ["fastapi"]), + ("torchvision.test.Dockerfile", ["torchvision"]), + ("jupyter-scheduler.test.Dockerfile", ["jupyter-scheduler"]), + ("ipywidgets.test.Dockerfile", ["ipywidgets"]), + ("supervisor.test.Dockerfile", ["supervisor"]), + ("tf-keras.test.Dockerfile",["tf-keras"]), + ("xgboost-gpu.test.Dockerfile", ["xgboost"]), + ("jupyter-collaboration.test.Dockerfile", ["jupyter-collaboration"]), + ("jupyter-server-proxy.test.Dockerfile", ["jupyter-server-proxy"]), + ], ) def test_dockerfiles_for_gpu(