Class: Gitlab::QA::Scenario::Test::Sanity::Version

Inherits:
Gitlab::QA::Scenario::Template show all
Defined in:
lib/gitlab/qa/scenario/test/sanity/version.rb

Overview

This test checks that the sha_version of a GitLab was authored in the window defined by the ‘weekday_hours` method. We perform a single API call to get the commit

Constant Summary collapse

SOURCE_MAP =
{
  '[email protected]:gitlab/gitlab-ee.git' => {
    host: 'dev.gitlab.org',
    project: 'gitlab/gitlab-ee'
  },
  '[email protected]:gitlab/gitlabhq.git' => {
    host: 'dev.gitlab.org',
    project: 'gitlab/gitlabhq'
  },
  '[email protected]:gitlab-org/gitlab.git' => {
    host: 'gitlab.com',
    project: 'gitlab-org/gitlab'
  },
  '[email protected]:gitlab-org/gitlab-foss.git' => {
    host: 'gitlab.com',
    project: 'gitlab-org/gitlab-foss'
  }
}.freeze

Instance Method Summary collapse

Methods inherited from Gitlab::QA::Scenario::Template

perform

Instance Method Details

#perform(release = 'ce') ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/gitlab/qa/scenario/test/sanity/version.rb', line 36

def perform(release = 'ce')
  version = Component::Gitlab.perform do |gitlab|
    gitlab.release = release
    gitlab.act do
      pull
      rails_version
    end
  end

  project = SOURCE_MAP[version[:source]][:project]
  host = SOURCE_MAP[version[:source]][:host]
  sha = version[:sha]
  commit = api_commit_detail(host, project, sha)

  if commit_within_hours?(commit['created_at'], weekday_hours(commit['created_at']))
    puts "Found commit #{sha} in recent history of #{project} on #{host}"
  else
    puts "Did not find #{sha} in recent history of #{project} on #{host}"
    exit 1
  end
end