Skip to content

Commit 5044e55

Browse files
committed
Add integration test
1 parent f56cdd8 commit 5044e55

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

test/integration/test-extra-remote-cmd.sh

+51
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,57 @@ else
104104
exit 1
105105
fi
106106

107+
echo "> test sync policy"
108+
109+
echo "* should NOT have the sync.timestamp file"
110+
RESULT=$(ls $CL_HOME/extra1 | grep -q "sync.timestamp")
111+
if [ $? -eq 0 ]; then
112+
echo "KO - should NOT have the sync.timestamp file"
113+
exit 1
114+
else
115+
echo "OK"
116+
fi
117+
# change the extra remote's sync policy to 'weekly'
118+
sed -i -e 's/always/weekly/g' $CL_HOME/config.json
119+
120+
# now remove one package from local repository and run command launcher to sync
121+
$CL_PATH config command_update_enabled true
122+
rm -rf $CL_HOME/extra1/command-launcher-demo
123+
124+
echo "* should install new package"
125+
RESULT=$($CL_PATH)
126+
echo "$RESULT" | grep -q "Update done! Enjoy coding!"
127+
if [ $? -eq 0 ]; then
128+
echo "OK"
129+
else
130+
echo "KO - should install new package"
131+
exit 1
132+
fi
133+
134+
echo "* should have the sync.timestamp file after sync"
135+
RESULT=$(ls $CL_HOME/extra1 | grep -q "sync.timestamp")
136+
if [ $? -eq 0 ]; then
137+
echo "OK"
138+
else
139+
echo "KO - should NOT have the sync.timestamp file"
140+
exit 1
141+
fi
142+
143+
# now remove the package again, should not install the package again
144+
rm -rf $CL_HOME/extra1/command-launcher-demo
145+
echo "* should NOT install new package"
146+
RESULT=$($CL_PATH)
147+
echo "$RESULT" | grep -q "Update done! Enjoy coding!"
148+
if [ $? -eq 0 ]; then
149+
echo "KO - should NOT install new package"
150+
exit 1
151+
else
152+
echo "OK"
153+
fi
154+
155+
# reset the config
156+
$CL_PATH config command_update_enabled false
157+
107158
echo "> test delete extra remote registry"
108159
RESULT=$($CL_PATH remote delete extra1)
109160
RESULT=$($CL_PATH remote list)

0 commit comments

Comments
 (0)