summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2018-02-09 20:58:26 +0800
committerLin Jen-Shin <godfat@godfat.org>2018-02-09 20:58:26 +0800
commit578a98fb447b2c98763c09b51d38d50c895ec925 (patch)
tree4fe8bff37f86af8e6e66de98d7960a32a5aaed2e
parent09a3b8fb655ac673a5d706548d13c26cdb53aa9f (diff)
downloadgitlab-ce-578a98fb447b2c98763c09b51d38d50c895ec925.tar.gz
Save host-verification test against SHA1 checksum
-rw-r--r--qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb b/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb
index a0761aab97d..91ade2649ac 100644
--- a/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb
+++ b/qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb
@@ -1,3 +1,5 @@
+require 'digest/sha1'
+
module QA
feature 'pull codes with a deploy key', :core, :docker do
let(:runner_name) { "qa-runner-#{Time.now.to_i}" }
@@ -43,19 +45,25 @@ module QA
repository_location
end
+ repository_uri = URI.parse(repository_url)
+
gitlab_ci =
<<~YAML
cat-config:
script:
+ - mkdir -p ~/.ssh
+ - ssh-keyscan -p #{repository_uri.port} #{repository_uri.host} >> ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- - echo "$DEPLOY_KEY" | tr -d '\\r' | ssh-add - > /dev/null
+ - echo "$DEPLOY_KEY" | ssh-add -
- git clone #{repository_url}
- - cat #{project.name}/.gitlab-ci.yml
+ - sha1sum #{project.name}/.gitlab-ci.yml
tags:
- qa
- docker
YAML
+ sha1sum = Digest::SHA1.hexdigest(gitlab_ci)
+
Factory::Repository::Push.fabricate! do |push|
push.project = project
push.file_name = '.gitlab-ci.yml'
@@ -76,7 +84,7 @@ module QA
end
Page::Project::Job::Show.perform do |job|
- expect(job.output).to include(gitlab_ci.tr("\n", ' '))
+ expect(job.output).to include(sha1sum)
end
end
end