Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 09:07:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-10-17 09:07:30 +0300
commit74b0522ed8b86edee204643c5484da1724a5a31b (patch)
tree54148ada389f9774acf3c4a0ab5db9ef138f0fb0 /qa
parent050f88965560f5ad38799a8344f7b8ac5e7a1b8d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r--qa/qa.rb1
-rw-r--r--qa/qa/runtime/fixtures.rb15
-rw-r--r--qa/qa/service/docker_run/node_js.rb38
3 files changed, 54 insertions, 0 deletions
diff --git a/qa/qa.rb b/qa/qa.rb
index 85ee017ccd4..a628c0e0e3f 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -407,6 +407,7 @@ module QA
module DockerRun
autoload :Base, 'qa/service/docker_run/base'
autoload :LDAP, 'qa/service/docker_run/ldap'
+ autoload :NodeJs, 'qa/service/docker_run/node_js'
autoload :GitlabRunner, 'qa/service/docker_run/gitlab_runner'
end
end
diff --git a/qa/qa/runtime/fixtures.rb b/qa/qa/runtime/fixtures.rb
index 02cecffd4df..f91218ea0b5 100644
--- a/qa/qa/runtime/fixtures.rb
+++ b/qa/qa/runtime/fixtures.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require 'tmpdir'
+
module QA
module Runtime
module Fixtures
@@ -18,6 +20,19 @@ module QA
parse_body(response)[:content]
end
+ def with_fixtures(fixtures)
+ dir = Dir.mktmpdir
+ fixtures.each do |file_def|
+ path = File.join(dir, file_def[:file_path])
+ FileUtils.mkdir_p(File.dirname(path))
+ File.write(path, file_def[:content])
+ end
+
+ yield dir
+ ensure
+ FileUtils.remove_entry(dir)
+ end
+
private
def api_client
diff --git a/qa/qa/service/docker_run/node_js.rb b/qa/qa/service/docker_run/node_js.rb
new file mode 100644
index 00000000000..642f1d1a33a
--- /dev/null
+++ b/qa/qa/service/docker_run/node_js.rb
@@ -0,0 +1,38 @@
+# frozen_string_literal: true
+
+module QA
+ module Service
+ module DockerRun
+ class NodeJs < Base
+ def initialize(volume_host_path)
+ @image = 'node:12.11.1-alpine'
+ @name = "qa-node-#{SecureRandom.hex(8)}"
+ @volume_host_path = volume_host_path
+
+ super()
+ end
+
+ def publish!
+ # When we run the tests via gitlab-qa, we use docker-in-docker
+ # which means that host of a volume mount would be the host that
+ # started the gitlab-qa QA container (e.g., the CI runner),
+ # not the gitlab-qa container itself. That means we can't
+ # mount a volume from the file system inside the gitlab-qa
+ # container.
+ #
+ # Instead, we copy the files into the container.
+ shell <<~CMD.tr("\n", ' ')
+ docker run -d --rm
+ --network #{network}
+ --hostname #{host_name}
+ --name #{@name}
+ --volume #{@volume_host_path}:/home/node
+ #{@image} sh -c "sleep 60"
+ CMD
+ shell "docker cp #{@volume_host_path}/. #{@name}:/home/node"
+ shell "docker exec -t #{@name} sh -c 'cd /home/node && npm publish'"
+ end
+ end
+ end
+ end
+end