mirror of
https://github.com/outbackdingo/ghorg.git
synced 2026-01-27 18:18:58 +00:00
Update gitlab cloud integration tests (#275)
This commit is contained in:
@@ -22,36 +22,61 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --output-dir=examples --preserve-dir
|
||||
#
|
||||
# TOP LEVEL GROUP TESTS
|
||||
#
|
||||
|
||||
if [ -e "${HOME}"/ghorg/examples/"${GITLAB_SUB_GROUP}"/wayne-industries/microservice ]
|
||||
# NO FLAGS
|
||||
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab
|
||||
|
||||
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/microservice ]
|
||||
then
|
||||
echo "Pass: gitlab org clone preserve directories"
|
||||
echo "Pass: gitlab org clone"
|
||||
rm -rf "${HOME}/ghorg/gitlab-examples"
|
||||
else
|
||||
echo "Fail: gitlab org clone preserve directories"
|
||||
echo "Fail: gitlab org clone"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ghorg clone $GITLAB_GROUP/$GITLAB_SUB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab
|
||||
# OUTPUT DIR
|
||||
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --output-dir=examples
|
||||
|
||||
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/"${GITLAB_SUB_GROUP}"/microservice ]
|
||||
if [ -e "${HOME}"/ghorg/examples/microservice ]
|
||||
then
|
||||
echo "Pass: gitlab subgroup clone flat file"
|
||||
echo "Pass: gitlab org clone output dir"
|
||||
rm -rf "${HOME}/ghorg/examples"
|
||||
else
|
||||
echo "Fail: gitlab subgroup clone flat file"
|
||||
echo "Fail: gitlab org clone output dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ghorg clone $GITLAB_GROUP/$GITLAB_SUB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --preserve-dir
|
||||
|
||||
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/"${GITLAB_SUB_GROUP}"/wayne-industries/microservice ]
|
||||
# PRESERVE DIR
|
||||
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --preserve-dir
|
||||
|
||||
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/wayne-enterprises/wayne-industries/microservice ]
|
||||
then
|
||||
echo "Pass: gitlab subgroup clone preserve directories"
|
||||
echo "Pass: gitlab org clone preserve dir"
|
||||
rm -rf "${HOME}/ghorg/${GITLAB_GROUP}"
|
||||
else
|
||||
echo "Fail: gitlab subgroup clone preserve directories"
|
||||
echo "Fail: gitlab org clone preserve dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# OUTPUT DIR AND PRESERVE DIR
|
||||
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --preserve-dir --output-dir=group-output-perserve
|
||||
|
||||
if [ -e "${HOME}"/ghorg/group-output-perserve/wayne-enterprises/wayne-industries/microservice ]
|
||||
then
|
||||
echo "Pass: gitlab org clone preserve dir, output dir"
|
||||
rm -rf "${HOME}/ghorg/${GITLAB_GROUP}"
|
||||
else
|
||||
echo "Fail: gitlab org clone preserve dir, output dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# REPO NAME COLLISION
|
||||
ghorg clone $GITLAB_GROUP_2 --token="${GITLAB_TOKEN}" --scm=gitlab
|
||||
|
||||
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP_2}"/_subgroup-1_foobar ]
|
||||
@@ -69,3 +94,54 @@ else
|
||||
echo "Fail: gitlab group clone with colliding repo names"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# SUBGROUP TESTS
|
||||
#
|
||||
|
||||
# NO FLAGS
|
||||
ghorg clone $GITLAB_GROUP/$GITLAB_SUB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab
|
||||
|
||||
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/"${GITLAB_SUB_GROUP}"/microservice ]
|
||||
then
|
||||
echo "Pass: gitlab subgroup clone flat file"
|
||||
rm -rf "${HOME}/ghorg/${GITLAB_GROUP}"
|
||||
else
|
||||
echo "Fail: gitlab subgroup clone flat file"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# OUTPUT DIR
|
||||
ghorg clone $GITLAB_GROUP/$GITLAB_SUB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --output-dir=example-output
|
||||
|
||||
if [ -e "${HOME}"/ghorg/example-output/microservice ]
|
||||
then
|
||||
echo "Pass: gitlab subgroup output dir"
|
||||
else
|
||||
echo "Fail: gitlab subgroup output dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# PRESERVE DIR
|
||||
ghorg clone $GITLAB_GROUP/$GITLAB_SUB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --preserve-dir
|
||||
|
||||
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/"${GITLAB_SUB_GROUP}"/wayne-industries/microservice ]
|
||||
then
|
||||
echo "Pass: gitlab subgroup clone preserve directories"
|
||||
rm -rf "${HOME}/ghorg/${GITLAB_GROUP}"
|
||||
else
|
||||
echo "Fail: gitlab subgroup clone preserve directories"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# OUTPUT DIR AND PRESERVE DIR
|
||||
ghorg clone $GITLAB_GROUP/$GITLAB_SUB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --preserve-dir --output-dir=examples-subgroup-preserve-output
|
||||
|
||||
if [ -e "${HOME}"/ghorg/examples-subgroup-preserve-output/"${GITLAB_GROUP}"/"${GITLAB_SUB_GROUP}"/wayne-industries/microservice ]
|
||||
then
|
||||
echo "Pass: gitlab subgroup clone preserve directories and output dir"
|
||||
rm -rf "${HOME}/ghorg/examples-subgroup-preserve-output"
|
||||
else
|
||||
echo "Fail: gitlab subgroup clone preserve directories and output dir"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -282,27 +282,7 @@ fi
|
||||
|
||||
rm -rf "${LOCAL_GITLAB_GHORG_DIR}"/local-gitlab-group3
|
||||
|
||||
############ CLONE AND TEST SUBGROUP, PRESERVE DIR, OUTPUT DIR ############
|
||||
ghorg clone local-gitlab-group3/subgroup-a --scm=gitlab --base-url="${GITLAB_URL}" --token="${TOKEN}" --preserve-dir --output-dir=local-gitlab-v15-group3-subgroup-a-preserve
|
||||
ghorg clone local-gitlab-group3/subgroup-a --scm=gitlab --base-url="${GITLAB_URL}" --token="${TOKEN}" --preserve-dir --output-dir=local-gitlab-v15-group3-subgroup-a-preserve
|
||||
|
||||
GOT=$(ghorg ls local-gitlab-v15-group3-subgroup-a-preserve/local-gitlab-group3/subgroup-a | grep -o 'local-gitlab-v15-group3-subgroup-a-preserve/local-gitlab-group3.*')
|
||||
WANT=$(cat <<EOF
|
||||
local-gitlab-v15-group3-subgroup-a-preserve/local-gitlab-group3/subgroup-a/subgroup-b
|
||||
local-gitlab-v15-group3-subgroup-a-preserve/local-gitlab-group3/subgroup-a/subgroup_a_repo_0
|
||||
local-gitlab-v15-group3-subgroup-a-preserve/local-gitlab-group3/subgroup-a/subgroup_a_repo_1
|
||||
local-gitlab-v15-group3-subgroup-a-preserve/local-gitlab-group3/subgroup-a/subgroup_a_repo_2
|
||||
local-gitlab-v15-group3-subgroup-a-preserve/local-gitlab-group3/subgroup-a/subgroup_a_repo_3
|
||||
EOF
|
||||
)
|
||||
|
||||
if [ "${WANT}" != "${GOT}" ]
|
||||
then
|
||||
echo "CLONE AND TEST SUBGROUP, PRESERVE DIR, OUTPUT DIR FAILED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
############ CLONE AND TEST SUBGROUP, OUTPUT DIR ############
|
||||
############ CLONE AND TEST SUBGROUP, NESTED SUBGROUB, OUTPUT DIR ############
|
||||
ghorg clone local-gitlab-group3/subgroup-a --scm=gitlab --base-url="${GITLAB_URL}" --token="${TOKEN}" --output-dir=local-gitlab-v15-group3-subgroup-a
|
||||
ghorg clone local-gitlab-group3/subgroup-a --scm=gitlab --base-url="${GITLAB_URL}" --token="${TOKEN}" --output-dir=local-gitlab-v15-group3-subgroup-a
|
||||
|
||||
@@ -321,7 +301,27 @@ EOF
|
||||
|
||||
if [ "${WANT}" != "${GOT}" ]
|
||||
then
|
||||
echo "CLONE AND TEST SUBGROUP, OUTPUT DIR FAILED"
|
||||
echo "CLONE AND TEST SUBGROUP, NESTED SUBGROUB, OUTPUT DIR FAILED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
############ CLONE AND TEST SUBGROUP, NESTED SUBGROUPS, PRESERVE DIR, OUTPUT DIR ############
|
||||
ghorg clone local-gitlab-group3/subgroup-a --scm=gitlab --base-url="${GITLAB_URL}" --token="${TOKEN}" --preserve-dir --output-dir=local-gitlab-v15-subgroups-preserve-output
|
||||
ghorg clone local-gitlab-group3/subgroup-a --scm=gitlab --base-url="${GITLAB_URL}" --token="${TOKEN}" --preserve-dir --output-dir=local-gitlab-v15-subgroups-preserve-output
|
||||
|
||||
GOT=$(ghorg ls local-gitlab-v15-subgroups-preserve-output/local-gitlab-group3/subgroup-a | grep -o 'local-gitlab-v15-subgroups-preserve-output/local-gitlab-group3.*')
|
||||
WANT=$(cat <<EOF
|
||||
local-gitlab-v15-subgroups-preserve-output/local-gitlab-group3/subgroup-a/subgroup-b
|
||||
local-gitlab-v15-subgroups-preserve-output/local-gitlab-group3/subgroup-a/subgroup_a_repo_0
|
||||
local-gitlab-v15-subgroups-preserve-output/local-gitlab-group3/subgroup-a/subgroup_a_repo_1
|
||||
local-gitlab-v15-subgroups-preserve-output/local-gitlab-group3/subgroup-a/subgroup_a_repo_2
|
||||
local-gitlab-v15-subgroups-preserve-output/local-gitlab-group3/subgroup-a/subgroup_a_repo_3
|
||||
EOF
|
||||
)
|
||||
|
||||
if [ "${WANT}" != "${GOT}" ]
|
||||
then
|
||||
echo "CLONE AND TEST SUBGROUP, NESTED SUBGROUPS, PRESERVE DIR, OUTPUT DIR FAILED"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user