11#! /bin/bash
22
3+ # Determine the script's directory and devstack root
4+ SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
5+ DEVSTACK_ROOT=" $( cd " $SCRIPT_DIR /.." && pwd ) "
6+
37TEST_WORKSPACE=" /tmp/devstack_test_$$ "
48mkdir -p " $TEST_WORKSPACE "
59
@@ -57,7 +61,7 @@ TOTAL_TESTS=$((TOTAL_TESTS + 1))
5761cd " $TEST_WORKSPACE "
5862create_test_repo " frontend-app-gradebook" " https://github.com/edx/frontend-app-gradebook.git"
5963show_remotes " frontend-app-gradebook" " BEFORE"
60- cd /workspaces/devstack
64+ cd " $DEVSTACK_ROOT "
6165echo " Output:"
6266DEVSTACK_WORKSPACE=" $TEST_WORKSPACE " make dev.setup-remotes
6367cd " $TEST_WORKSPACE "
@@ -75,7 +79,7 @@ echo "TEST 2: EDX Origin Repository (edx-platform)"
7579TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
7680create_test_repo " edx-platform" " https://github.com/edx/edx-platform.git"
7781show_remotes " edx-platform" " BEFORE"
78- cd /workspaces/devstack
82+ cd " $DEVSTACK_ROOT "
7983echo " Output:"
8084DEVSTACK_WORKSPACE=" $TEST_WORKSPACE " make dev.setup-remotes
8185cd " $TEST_WORKSPACE "
@@ -93,7 +97,7 @@ echo "TEST 3: OpenEDX Origin Repository (course-discovery)"
9397TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
9498create_test_repo " course-discovery" " https://github.com/openedx/course-discovery.git"
9599show_remotes " course-discovery" " BEFORE"
96- cd /workspaces/devstack
100+ cd " $DEVSTACK_ROOT "
97101echo " Output:"
98102DEVSTACK_WORKSPACE=" $TEST_WORKSPACE " make dev.setup-remotes
99103cd " $TEST_WORKSPACE "
@@ -112,7 +116,7 @@ echo "TEST 4: Personal Fork Error"
112116TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
113117create_test_repo " credentials" " https://github.com/personaluser/credentials.git"
114118show_remotes " credentials" " BEFORE"
115- cd /workspaces/devstack
119+ cd " $DEVSTACK_ROOT "
116120echo " Output:"
117121DEVSTACK_WORKSPACE=" $TEST_WORKSPACE " make dev.setup-remotes
118122cd " $TEST_WORKSPACE "
@@ -130,7 +134,7 @@ echo "TEST 5: Non-Forked Repository"
130134TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
131135create_test_repo " unknown-repo" " https://github.com/edx/unknown-repo.git"
132136show_remotes " unknown-repo" " BEFORE"
133- cd /workspaces/devstack
137+ cd " $DEVSTACK_ROOT "
134138echo " Output:"
135139DEVSTACK_WORKSPACE=" $TEST_WORKSPACE " make dev.setup-remotes
136140cd " $TEST_WORKSPACE "
@@ -148,12 +152,12 @@ echo "TEST 6: Idempotent Operations"
148152TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
149153create_test_repo " frontend-app-gradebook" " https://github.com/edx/frontend-app-gradebook.git"
150154show_remotes " frontend-app-gradebook" " BEFORE (fresh repo)"
151- cd /workspaces/devstack
155+ cd " $DEVSTACK_ROOT "
152156echo " First run output:"
153157DEVSTACK_WORKSPACE=" $TEST_WORKSPACE " make dev.setup-remotes
154158cd " $TEST_WORKSPACE "
155159show_remotes " frontend-app-gradebook" " AFTER FIRST RUN"
156- cd /workspaces/devstack
160+ cd " $DEVSTACK_ROOT "
157161echo " Second run output (should be idempotent):"
158162DEVSTACK_WORKSPACE=" $TEST_WORKSPACE " make dev.setup-remotes
159163cd " $TEST_WORKSPACE "
@@ -169,7 +173,7 @@ cd ..
169173echo
170174echo " TEST 7: Make Integration"
171175TOTAL_TESTS=$(( TOTAL_TESTS + 1 ))
172- cd /workspaces/devstack
176+ cd " $DEVSTACK_ROOT "
173177if make -n dev.setup-remotes > /dev/null 2>&1 && make help | grep -q " dev.setup-remotes" ; then
174178 print_pass " Make command integration"
175179else
0 commit comments