From 5044e55d86e2f77e0ff08202bbb75f7c56274c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=F0=9F=8E=B3=20Bo=20HOU?= Date: Tue, 31 Dec 2024 17:59:51 +0100 Subject: [PATCH] Add integration test --- test/integration/test-extra-remote-cmd.sh | 51 +++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/test/integration/test-extra-remote-cmd.sh b/test/integration/test-extra-remote-cmd.sh index d3937ca..3e053ff 100755 --- a/test/integration/test-extra-remote-cmd.sh +++ b/test/integration/test-extra-remote-cmd.sh @@ -104,6 +104,57 @@ else exit 1 fi +echo "> test sync policy" + +echo "* should NOT have the sync.timestamp file" +RESULT=$(ls $CL_HOME/extra1 | grep -q "sync.timestamp") +if [ $? -eq 0 ]; then + echo "KO - should NOT have the sync.timestamp file" + exit 1 +else + echo "OK" +fi +# change the extra remote's sync policy to 'weekly' +sed -i -e 's/always/weekly/g' $CL_HOME/config.json + +# now remove one package from local repository and run command launcher to sync +$CL_PATH config command_update_enabled true +rm -rf $CL_HOME/extra1/command-launcher-demo + +echo "* should install new package" +RESULT=$($CL_PATH) +echo "$RESULT" | grep -q "Update done! Enjoy coding!" +if [ $? -eq 0 ]; then + echo "OK" +else + echo "KO - should install new package" + exit 1 +fi + +echo "* should have the sync.timestamp file after sync" +RESULT=$(ls $CL_HOME/extra1 | grep -q "sync.timestamp") +if [ $? -eq 0 ]; then + echo "OK" +else + echo "KO - should NOT have the sync.timestamp file" + exit 1 +fi + +# now remove the package again, should not install the package again +rm -rf $CL_HOME/extra1/command-launcher-demo +echo "* should NOT install new package" +RESULT=$($CL_PATH) +echo "$RESULT" | grep -q "Update done! Enjoy coding!" +if [ $? -eq 0 ]; then + echo "KO - should NOT install new package" + exit 1 +else + echo "OK" +fi + +# reset the config +$CL_PATH config command_update_enabled false + echo "> test delete extra remote registry" RESULT=$($CL_PATH remote delete extra1) RESULT=$($CL_PATH remote list)