Commit 578a98fb authored by Lin Jen-Shin's avatar Lin Jen-Shin

Save host-verification test against SHA1 checksum

parent 09a3b8fb
require 'digest/sha1'
module QA module QA
feature 'pull codes with a deploy key', :core, :docker do feature 'pull codes with a deploy key', :core, :docker do
let(:runner_name) { "qa-runner-#{Time.now.to_i}" } let(:runner_name) { "qa-runner-#{Time.now.to_i}" }
...@@ -43,19 +45,25 @@ module QA ...@@ -43,19 +45,25 @@ module QA
repository_location repository_location
end end
repository_uri = URI.parse(repository_url)
gitlab_ci = gitlab_ci =
<<~YAML <<~YAML
cat-config: cat-config:
script: script:
- mkdir -p ~/.ssh
- ssh-keyscan -p #{repository_uri.port} #{repository_uri.host} >> ~/.ssh/known_hosts
- eval $(ssh-agent -s) - eval $(ssh-agent -s)
- echo "$DEPLOY_KEY" | tr -d '\\r' | ssh-add - > /dev/null - echo "$DEPLOY_KEY" | ssh-add -
- git clone #{repository_url} - git clone #{repository_url}
- cat #{project.name}/.gitlab-ci.yml - sha1sum #{project.name}/.gitlab-ci.yml
tags: tags:
- qa - qa
- docker - docker
YAML YAML
sha1sum = Digest::SHA1.hexdigest(gitlab_ci)
Factory::Repository::Push.fabricate! do |push| Factory::Repository::Push.fabricate! do |push|
push.project = project push.project = project
push.file_name = '.gitlab-ci.yml' push.file_name = '.gitlab-ci.yml'
...@@ -76,7 +84,7 @@ module QA ...@@ -76,7 +84,7 @@ module QA
end end
Page::Project::Job::Show.perform do |job| 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 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