Skip to content

Commit 8eab237

Browse files
Add test for validating anaconda channels (#652)
1 parent 372f050 commit 8eab237

File tree

5 files changed

+86
-0
lines changed

5 files changed

+86
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ARG SAGEMAKER_DISTRIBUTION_IMAGE
2+
FROM $SAGEMAKER_DISTRIBUTION_IMAGE
3+
4+
ARG MAMBA_DOCKERFILE_ACTIVATE=1
5+
6+
COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_anaconda_tests.sh .
7+
RUN chmod +x run_anaconda_tests.sh
8+
CMD ["./run_anaconda_tests.sh"]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Expected output
4+
expected_output=$'channels:\n - conda-forge'
5+
6+
# Actual output
7+
actual_micromamba=$(micromamba config list channels)
8+
actual_conda=$(conda config --show channels)
9+
10+
# Compare the outputs
11+
if [ "$actual_micromamba" = "$expected_output" ]; then
12+
echo "Micromamba Validation passed: Output matches expected format"
13+
exit 0
14+
else
15+
echo "Micromamba Validation failed: Output does not match expected format"
16+
echo "Expected:"
17+
echo "$expected_output"
18+
echo "Actual:"
19+
echo "$actual_micromamba"
20+
exit 1
21+
fi
22+
23+
# Compare the outputs
24+
if [ "$actual_conda" = "$expected_output" ]; then
25+
echo "Conda Validation passed: Output matches expected format"
26+
exit 0
27+
else
28+
echo "Conda Validation failed: Output does not match expected format"
29+
echo "Expected:"
30+
echo "$expected_output"
31+
echo "Actual:"
32+
echo "$actual_conda"
33+
exit 1
34+
fi
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ARG SAGEMAKER_DISTRIBUTION_IMAGE
2+
FROM $SAGEMAKER_DISTRIBUTION_IMAGE
3+
4+
ARG MAMBA_DOCKERFILE_ACTIVATE=1
5+
6+
COPY --chown=$MAMBA_USER:$MAMBA_USER scripts/run_anaconda_tests.sh .
7+
RUN chmod +x run_anaconda_tests.sh
8+
CMD ["./run_anaconda_tests.sh"]
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Expected output
4+
expected_output=$'channels:\n - conda-forge'
5+
6+
# Actual output
7+
actual_micromamba=$(micromamba config list channels)
8+
actual_conda=$(conda config --show channels)
9+
10+
# Compare the outputs
11+
if [ "$actual_micromamba" = "$expected_output" ]; then
12+
echo "Micromamba Validation passed: Output matches expected format"
13+
exit 0
14+
else
15+
echo "Micromamba Validation failed: Output does not match expected format"
16+
echo "Expected:"
17+
echo "$expected_output"
18+
echo "Actual:"
19+
echo "$actual_micromamba"
20+
exit 1
21+
fi
22+
23+
# Compare the outputs
24+
if [ "$actual_conda" = "$expected_output" ]; then
25+
echo "Conda Validation passed: Output matches expected format"
26+
exit 0
27+
else
28+
echo "Conda Validation failed: Output does not match expected format"
29+
echo "Expected:"
30+
echo "$expected_output"
31+
echo "Actual:"
32+
echo "$actual_conda"
33+
exit 1
34+
fi

test/test_dockerfile_based_harness.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@pytest.mark.parametrize(
1919
"dockerfile_path, required_packages",
2020
[
21+
("anaconda.test.Dockerfile", ["conda"]),
2122
("keras.test.Dockerfile", ["keras"]),
2223
("autogluon.test.Dockerfile", ["autogluon"]),
2324
("matplotlib.test.Dockerfile", ["matplotlib"]),
@@ -102,6 +103,7 @@ def test_dockerfiles_for_cpu(
102103
@pytest.mark.parametrize(
103104
"dockerfile_path, required_packages",
104105
[
106+
("anaconda.test.Dockerfile", ["conda"]),
105107
("keras.test.Dockerfile", ["keras"]),
106108
("autogluon.test.Dockerfile", ["autogluon"]),
107109
("matplotlib.test.Dockerfile", ["matplotlib"]),

0 commit comments

Comments
 (0)