Commit d0b08f1c authored by Grzegorz Bizon's avatar Grzegorz Bizon

Add GitLab Runner service to GitLab QA

parent 63dbcd24
...@@ -126,10 +126,13 @@ module QA ...@@ -126,10 +126,13 @@ module QA
end end
## ##
# Classes describing shell interaction with GitLab # Classes describing services being part of GitLab and how we can interact
# with these services, like through the shell.
# #
module Shell module Service
autoload :Omnibus, 'qa/shell/omnibus' autoload :Shellable, 'qa/service/shellable'
autoload :Omnibus, 'qa/service/omnibus'
autoload :Runner, 'qa/service/runner'
end end
## ##
......
module QA
module Service
class Omnibus
include Scenario::Actable
include Service::Shellout
def initialize(container)
@name = container
end
def gitlab_ctl(command, input: nil)
if input.nil?
shell "docker exec #{@name} gitlab-ctl #{command}"
else
shell "docker exec #{@name} bash -c '#{input} | gitlab-ctl #{command}'"
end
end
end
end
end
module QA
module Service
class Runner
include Scenario::Actable
include Service::Shellout
def initialize(image)
@image = image
end
def pull
shell "docker pull #{@image}"
end
def register(token)
raise NotImplementedError
end
def run
raise NotImplementedError
end
def remove
raise NotImplementedError
end
end
end
end
require 'open3' require 'open3'
module QA module QA
module Shell module Service
class Omnibus module Shellout
include Scenario::Actable
def initialize(container)
@name = container
end
def gitlab_ctl(command, input: nil)
if input.nil?
shell "docker exec #{@name} gitlab-ctl #{command}"
else
shell "docker exec #{@name} bash -c '#{input} | gitlab-ctl #{command}'"
end
end
private
## ##
# TODO, make it possible to use generic QA framework classes # TODO, make it possible to use generic QA framework classes
# as a library - gitlab-org/gitlab-qa#94 # as a library - gitlab-org/gitlab-qa#94
...@@ -30,7 +14,7 @@ module QA ...@@ -30,7 +14,7 @@ module QA
out.each { |line| puts line } out.each { |line| puts line }
if wait.value.exited? && wait.value.exitstatus.nonzero? if wait.value.exited? && wait.value.exitstatus.nonzero?
raise "Docker command `#{command}` failed!" raise "Command `#{command}` failed!"
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment