@@ -15,6 +15,13 @@ def fixture_dir(test_dir):
1515
1616
1717def reset_gitlab (gl ):
18+ if _is_gitlab_ee (gl ):
19+ # NOTE(jlvillal): By default in GitLab EE it will wait 7 days before
20+ # deleting a group. Change it to 0 days.
21+ settings = gl .settings .get ()
22+ if settings .deletion_adjourned_period != 0 :
23+ settings .deletion_adjourned_period = 0
24+ settings .save ()
1825 # previously tools/reset_gitlab.py
1926 for project in gl .projects .list ():
2027 for deploy_token in project .deploytokens .list ():
@@ -134,7 +141,7 @@ def gitlab_config(check_is_alive, docker_ip, docker_services, temp_dir, fixture_
134141 port = docker_services .port_for ("gitlab" , 80 )
135142
136143 docker_services .wait_until_responsive (
137- timeout = 200 , pause = 5 , check = lambda : check_is_alive ("gitlab-test" )
144+ timeout = 300 , pause = 5 , check = lambda : check_is_alive ("gitlab-test" )
138145 )
139146
140147 token = set_token ("gitlab-test" , fixture_dir = fixture_dir )
@@ -164,6 +171,25 @@ def gl(gitlab_config):
164171 return instance
165172
166173
174+ @pytest .fixture (scope = "session" )
175+ def is_gitlab_ee (gl ) -> bool :
176+ """Fixture to determine if we are running with GitLab EE as opposed to
177+ GitLab CE"""
178+ return _is_gitlab_ee (gl = gl )
179+
180+
181+ def _is_gitlab_ee (gl : gitlab .Gitlab ) -> bool :
182+ """Determine if we are running with GitLab EE as opposed to GitLab CE"""
183+ try :
184+ license = gl .get_license ()
185+ except gitlab .exceptions .GitlabLicenseError :
186+ license = None
187+ # If we have a license then we assume we are running on GitLab EE
188+ if license :
189+ return True
190+ return False
191+
192+
167193@pytest .fixture (scope = "session" )
168194def gitlab_runner (gl ):
169195 container = "gitlab-runner-test"
0 commit comments