From 578a98fb447b2c98763c09b51d38d50c895ec925 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Fri, 9 Feb 2018 20:58:26 +0800 Subject: Save host-verification test against SHA1 checksum --- qa/qa/specs/features/cicd/pull_with_deploy_key_spec.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'qa') 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 -- cgit v1.2.1