-
-
Notifications
You must be signed in to change notification settings - Fork 182
Expand file tree
/
Copy pathgitlab_cloud_integration_tests.sh
More file actions
executable file
·222 lines (180 loc) · 6.74 KB
/
gitlab_cloud_integration_tests.sh
File metadata and controls
executable file
·222 lines (180 loc) · 6.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/bash
set -euo pipefail
echo "Running GitLab Cloud Integration Tests"
cp ./ghorg /usr/local/bin
# https://gitlab.com/gitlab-examples
GITLAB_GROUP=gitlab-examples
GITLAB_SUB_GROUP=wayne-enterprises
GITLAB_GROUP_2=ghorg-test-group
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --output-dir=examples-flat
if [ -e "${HOME}"/ghorg/examples-flat/microservice ]
then
echo "Pass: gitlab org clone flat file"
else
echo "Fail: gitlab org clone flat file"
exit 1
fi
# preserve scm hostname
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --output-dir=examples-flat --preserve-scm-hostname
if [ -e "${HOME}"/ghorg/gitlab.com/examples-flat/microservice ]
then
echo "Pass: gitlab org clone flat file, preserve scm hostname"
else
echo "Fail: gitlab org clone flat file, preserve scm hostname"
exit 1
fi
#
# TOP LEVEL GROUP TESTS
#
# NO FLAGS
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/microservice ]
then
echo "Pass: gitlab org clone"
rm -rf "${HOME}/ghorg/gitlab-examples"
else
echo "Fail: gitlab org clone"
exit 1
fi
# OUTPUT DIR
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --output-dir=examples
if [ -e "${HOME}"/ghorg/examples/microservice ]
then
echo "Pass: gitlab org clone output dir"
rm -rf "${HOME}/ghorg/examples"
else
echo "Fail: gitlab org clone output dir"
exit 1
fi
# 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 org clone preserve dir"
rm -rf "${HOME}/ghorg/${GITLAB_GROUP}"
else
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
# PRUNE AND PRESERVE DIR
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --prune --preserve-dir --prune-no-confirm
git init "${HOME}"/ghorg/"${GITLAB_GROUP}"/wayne-enterprises/wayne-industries/prunable
ghorg clone $GITLAB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --prune --preserve-dir --prune-no-confirm
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/wayne-enterprises/wayne-industries/microservice ] && \
[ ! -e "${HOME}"/ghorg/"${GITLAB_GROUP}"/wayne-enterprises/wayne-industries/prunable ]
then
echo "Pass: gitlab org clone preserve dir, prune"
rm -rf "${HOME}/ghorg/${GITLAB_GROUP}"
else
echo "Fail: gitlab org clone preserve dir, prune"
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 ]
then
echo "Pass: gitlab group clone with colliding repo names"
else
echo "Fail: gitlab group clone with colliding repo names"
exit 1
fi
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP_2}"/_subgroup-2_foobar ]
then
echo "Pass: gitlab group clone with colliding repo names"
else
echo "Fail: gitlab group clone with colliding repo names"
exit 1
fi
# SNIPPETS
ghorg clone $GITLAB_GROUP_2 --token="${GITLAB_TOKEN}" --scm=gitlab --clone-snippets --preserve-dir
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP_2}"/subgroup-2/foobar.snippets/test-snippet-2-3711655 ]
then
echo "Pass: gitlab group clone snippet 2 with preserve dir"
else
echo "Fail: gitlab group clone snippet 2 with preserve dir"
exit 1
fi
if [ -e "${HOME}"/ghorg/"${GITLAB_GROUP_2}"/subgroup-2/foobar.snippets/test-snippet-1-3711654 ]
then
echo "Pass: gitlab group clone snippet 1 with preserve dir"
else
echo "Fail: gitlab group clone snippet 1 with preserve dir"
exit 1
fi
ghorg clone $GITLAB_GROUP_2 --token="${GITLAB_TOKEN}" --scm=gitlab --clone-snippets --preserve-dir --preserve-scm-hostname
if [ -e "${HOME}"/ghorg/gitlab.com/"${GITLAB_GROUP_2}"/subgroup-2/foobar.snippets/test-snippet-2-3711655 ]
then
echo "Pass: gitlab group clone snippet 2 with preserve dir, preserve scm hostname"
else
echo "Fail: gitlab group clone snippet 2 with preserve dir, preserve scm hostname"
exit 1
fi
if [ -e "${HOME}"/ghorg/gitlab.com/"${GITLAB_GROUP_2}"/subgroup-2/foobar.snippets/test-snippet-1-3711654 ]
then
echo "Pass: gitlab group clone snippet 1 with preserve dir, preserve scm hostname"
else
echo "Fail: gitlab group clone snippet 1 with preserve dir, preserve scm hostname"
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
# PRESERVE DIR, PRESERVE SCM HOSTNAME
ghorg clone $GITLAB_GROUP/$GITLAB_SUB_GROUP --token="${GITLAB_TOKEN}" --scm=gitlab --preserve-dir --preserve-scm-hostname
if [ -e "${HOME}"/ghorg/gitlab.com/"${GITLAB_GROUP}"/"${GITLAB_SUB_GROUP}"/wayne-industries/microservice ]
then
echo "Pass: gitlab subgroup clone preserve directories, preserve scm hostname"
rm -rf "${HOME}/ghorg/gitlab.com/${GITLAB_GROUP}"
else
echo "Fail: gitlab subgroup clone preserve directories, preserve scm hostname"
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