Skip to content
Snippets Groups Projects
Commit c0a71291b3ac authored by Georges Racinet's avatar Georges Racinet
Browse files

New GdkHeptapod concrete class

It derives from SourceHeptapod, only adding service management
and rake capabilities, hence being able to support backup tests
and other tests that require service management.
parent 4316399e1320
No related branches found
No related tags found
1 merge request!37Service management utilities and support for GDK installations
import contextlib
from io import BytesIO
import logging
import os
from pathlib import Path
import requests
import selenium.webdriver
......@@ -4,6 +5,7 @@
from pathlib import Path
import requests
import selenium.webdriver
import shutil
import subprocess
import sys
import tarfile
......@@ -505,3 +507,43 @@
def put_file_lines(self, path, lines):
with open(path, 'w') as fobj:
fobj.writelines(lines)
class GdkHeptapod(SourceHeptapod):
"""An Heptapod server running with the GDK.
"""
fs_access = True
shell_access = True
reverse_call_host = 'localhost'
RAILS_SERVICES = ('rails-web', 'rails-background-jobs')
def __init__(self, gdk_root, **kw):
self.gdk_root = gdk_root
self.rails_root = os.path.join(gdk_root, 'gitlab')
super(GdkHeptapod, self).__init__(
repositories_root=os.path.join(gdk_root, 'repositories'),
**kw)
@property
def backups_dir(self):
return os.path.join(self.rails_root, 'tmp', 'backups')
def remove_all_backups(self):
if os.path.exists(self.backups_dir):
shutil.rmtree(self.backups_dir)
# as of GitLab 12.10, parent dir is always present
os.mkdir(self.backups_dir)
def rake(self, *args):
cmd = ['bundle', 'exec', 'rake']
cmd.extend(args)
subprocess.check_call(cmd, cwd=self.rails_root)
def ctl_services(self, command, services):
for service in services:
subprocess.check_call(('gdk', command, service),
cwd=self.rails_root)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment