feat(test): Improve gitfs tests with salt-minion integration

This commit is contained in:
Carlos Álvaro
2022-11-10 10:40:31 +01:00
parent 5bb8f1aff8
commit ea513c0fd8

View File

@@ -34,9 +34,26 @@ UPDATE_REPOS="$( salt-run fileserver.update )"
echo "${UPDATE_REPOS}" | grep -qi true || error "update gitfs"
ok "update gitfs"
# Check pillars
# Check gitfs files
echo "==> Checking gitfs files ..."
FILE_LIST=$( salt-run fileserver.file_list )
echo "${FILE_LIST}"
[[ "${FILE_LIST}" == *test.txt* ]] || error "gitfs files"
ok "gitfs files"
# Test minion connection
setup_and_start_salt_minion || error "salt-minion started"
ok "salt-minion started"
# Test pillar
echo "==> Checking gitfs pillar docker-salt-master-test:email content from minion ..."
PILLAR_CONTENT="$( salt "${TEST_MINION_ID}" pillar.get 'docker-salt-master-test:email' || error "Unable to get pillar 'docker-salt-master-test:email'" )"
echo "${PILLAR_CONTENT}"
echo -n "${PILLAR_CONTENT}" | grep -q 'github@cdalvaro.io' || error "Check gitfs pillar 'docker-salt-master-test:email'"
ok "Check gitfs pillar 'docker-salt-master-test:email'"
# Test gitfs deploy
echo "==> Checking gitfs top.sls (state.apply) ..."
salt "${TEST_MINION_ID}" state.apply
[ -f /tmp/my_file.txt ] || error "Check gitfs top.sls applied"
ok "Check gitfs top.sls applied"