Skip to content

Commit 67ad752

Browse files
committed
fix hf mirror bug and related test cases
1 parent b2c0c5b commit 67ad752

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/magicmirror/install.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ if [ "${OS}" = '"Ubuntu"' ] && [ -n "${UBUNTU_MIRROR}" ]; then
2828
sed -i "s/ports.ubuntu.com/${UBUNTU_MIRROR}/g" /etc/apt/sources.list
2929
fi
3030

31-
# Pypi mirror. TODO[sidecus]: Check Python installation
31+
# Pypi mirror.
3232
PYPI_MIRROR=${PYPI_MIRROR:-""}
3333
echo "PYPI_MIRROR: $PYPI_MIRROR"
3434
if [ -n "${PYPI_MIRROR}" ]; then
@@ -53,6 +53,7 @@ echo "HUGGINGFACE_MIRROR: $HUGGINGFACE_MIRROR"
5353
if [ -n "${HUGGINGFACE_MIRROR}" ]; then
5454
echo "Enabling Huggingface mirror: ${HUGGINGFACE_MIRROR}"
5555
touch /etc/environment && cp /etc/environment /etc/environment.mm.bak
56-
echo "HF_ENDPOINT=${HF_ENDPOINT}" >> /etc/environment
56+
echo "HF_ENDPOINT=${HUGGINGFACE_MIRROR}" >> /etc/environment
57+
# export the new env
5758
set -a; . /etc/environment; set +a;
5859
fi

test/magicmirror/hf.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ source dev-container-features-test-lib
1010

1111
# Feature-specific tests
1212
# The 'check' command comes from the dev-container-features-test-lib.
13-
check "test HF mirror" bash -c '[ "${HF_ENDPOINT}"="https://dummy-hf-mirror.com" ];'
13+
check "test HF mirror" bash -c "test \"${HF_ENDPOINT}\" = \"https://dummy-hf-mirror.com\""
1414

1515
# Report results
1616
# If any of the checks above exited with a non-zero exit code, the test will fail.

test/magicmirror/test.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
# UBUNTU_MIRROR=""
2121
# PYPI_MIRROR=""
2222
# APK_MIRROR=""
23+
# HUGGINGFACE_MIRROR=""
2324

2425
#
2526
# These scripts are run as 'root' by default. Although that can be changed
@@ -44,9 +45,10 @@ source dev-container-features-test-lib
4445
# Feature-specific tests
4546
# The 'check' command comes from the dev-container-features-test-lib. Syntax is...
4647
# check <LABEL> <cmd> [args...]
47-
check "test no ubuntu mirror" bash -c "! (test -e /etc/apt/sources.list.bak) && ! (cat /etc/apt/sources.list | grep 'mirrors.bfsu.edu.cn')"
48-
check "test no pypi mirror" bash -c "! (test -e /etc/pip.conf) || ! (cat /etc/pip.conf | grep 'mirrors.bfsu.edu.cn')"
49-
check "test no apk mirror" bash -c "! (test -e /etc/apk/repositories) || ! (cat /etc/apk/repositories | grep 'mirrors.tuna.tsinghua.edu.cn')"
48+
check "test no ubuntu mirror" bash -c "! (test -f /etc/apt/sources.list.mm.bak)"
49+
check "test no pypi mirror" bash -c "! (test -f /etc/pip.conf.mm.bak)"
50+
check "test no apk mirror" bash -c "! (test -f /etc/apk/repositories.mm.bak)"
51+
check "test no huggingface mirror" bash -c "! (test -f /etc/environment.mm.bak) && (test -z \"${HF_ENDPOINT}\"))"
5052

5153
# Report results
5254
# If any of the checks above exited with a non-zero exit code, the test will fail.

0 commit comments

Comments
 (0)