diff --git a/.sync.yml b/.sync.yml index 4173c3fb..e5dbef3f 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,5 +1,11 @@ --- .travis.yml: + docker_sets: + - set: centos6-64 + - set: centos7-64 + - set: ubuntu1604-64 + - set: ubuntu1404-64 + - set: debian8-64 secure: "iStKD31BM2tH9V3IbVJ0BTekwPWwhZbj4rb+6Xiz44cL4pNTHX3ymiAmbGjP0tlVbkzr1+jgUiTXG7ubLG0lTr2mjbgmBWa8ZcyH933HTZ7pzwIUtBjKuZjHT9vG1qZ3MPLDgb9R/i1qRj9rk6pRNlAyhqk5B/ynmO1uzcPneQHo8wToN/WvFGQIw/9I/FFWQQO/6Ap9LpD7xSF5ZAcg94tMpTkBebEuibZOi3Ze5Ah3zf2vHOOFSRcTTrFynyn1mYkUFU1xaOuoqvyTp7Tv+M1+uB1zIXJSJ4oNNeWsC5mLkKz1UBT5GQN7CFaFLawmGqhLQx29sk483Y5+K1NIX8UST47oZFc+bTQjAWJPlVj16lMApB1AXBzov3Cdz3n7GOfZla4BK/2FLqXXbG2KLMMQS/dG3rnLFM4vCT3ED48ZIXV4mb+wpbiXPV4HlOhEbtMSNwXwgWzq3+9yn2PO0rrmGA8tYeY1+ffHoyYGu4aiXO6xzQE8Xbp4LqDeYzRRM078t5BlYyuaU6ZTYgCVFoS9weQETGD1soF8nRObD9Flk2kB+XRIaQytIkQwOR8B28Z44L4ha5syfqvNbuNcJWHvJJNkhT9WlfdcQdmTdIPhglrCGrPtiVp83Ictps6qL5mJRpWcVQarubOGac2YfWC6CBFvxgo7lMFSoYFR3gc=" spec/spec_helper.rb: spec_overrides: diff --git a/.travis.yml b/.travis.yml index 2d50f36a..ede05224 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,96 @@ matrix: - rvm: 2.4.4 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos6-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6-nightly BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required branches: only: - master diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/gitlab_spec.rb similarity index 80% rename from spec/acceptance/class_spec.rb rename to spec/acceptance/gitlab_spec.rb index 0be1cafb..f7a7b7f6 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/gitlab_spec.rb @@ -2,7 +2,6 @@ describe 'gitlab class' do context 'default parameters' do - # Using puppet_apply as a helper it 'idempotently with no errors' do pp = <<-EOS class { 'gitlab': @@ -10,7 +9,6 @@ class { 'gitlab': } EOS - # Run it twice and test for idempotency apply_manifest(pp, catch_failures: true) apply_manifest(pp, catch_changes: true) end @@ -22,7 +20,7 @@ class { 'gitlab': it 'allows http connection on port 8080' do shell 'sleep 15' # give it some time to start up describe command('curl 0.0.0.0:80/users/sign_in') do - its(:stdout) { is_expected.to match %r{/GitLab|password/} } + its(:stdout) { is_expected.to match %r{.*reset_password_token=.*redirected.*} } end end end diff --git a/spec/acceptance/travis_ci_acceptance_spec.rb b/spec/acceptance/travis_ci_acceptance_spec.rb deleted file mode 100644 index fb3c3578..00000000 --- a/spec/acceptance/travis_ci_acceptance_spec.rb +++ /dev/null @@ -1,72 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'gitlab class' do - context 'travis specific docker tests' do - # Using puppet_apply as a helper - it 'idempotently with no errors' do - pp = <<-EOS - class { 'gitlab': - external_url => "http://${::fqdn}", - service_manage => false, - } - EOS - - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - it 'reconfigure when config changes' do - # gitlab-omnibus works differently in docker - # Requires manual kick for travis beaker docker tests - docker_workaround = <<-EOS - exec { '/opt/gitlab/embedded/bin/runsvdir-start &': - onlyif => '/bin/cat /proc/self/cgroup | grep docker' - } - EOS - - apply_manifest(docker_workaround, catch_failures: true) - - start_service_pp = <<-EOS - class { 'gitlab': - external_url => "http://${::fqdn}", - gitlab_rails => { 'time_zone' => 'GMT' } - } - EOS - - apply_manifest(start_service_pp, catch_failures: true, show_diff: true) do |r| - expect(r.stdout).to match(%r{/Scheduling refresh of Exec\[gitlab_reconfigure\]/}) - end - end - - describe package('gitlab-ce') do - it { is_expected.to be_installed } - end - - context 'allows http connection on port 80' do - describe command('curl 0.0.0.0:80/users/sign_in') do - its(:stdout) { is_expected.to match %r{/reset_password_token|GitLab/} } - end - end - end - - describe 'gitlab::cirunner class' do - context 'basic parameters without docker' do - it 'idempotently with no errors' do - pp = <<-EOS - class { 'gitlab::cirunner': - manage_docker => false, # Running docker in docker in travis breaks things - } - EOS - - # Run it twice and test for idempotency - apply_manifest(pp, catch_failures: true) - apply_manifest(pp, catch_changes: true) - end - - describe package('gitlab-runner') do - it { is_expected.to be_installed } - end - end - end -end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index b067c7b1..06c6ed48 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,24 +1,28 @@ -require 'beaker-rspec/spec_helper' -require 'beaker-rspec/helpers/serverspec' +require 'beaker-rspec' +require 'beaker-puppet' require 'beaker/puppet_install_helper' +require 'beaker/module_install_helper' run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' +install_module +install_module_dependencies RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - - # Readable test descriptions - c.formatter = :documentation - - # Configure all nodes in nodeset + # Configure all nodes c.before :suite do - # Install module and dependencies - puppet_module_install(source: proj_root, module_name: 'gitlab') - hosts.each do |host| - on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0] - on host, puppet('module', 'install', 'puppetlabs-apt'), acceptable_exit_codes: [0] - on host, puppet('module', 'install', 'garethr-docker'), acceptable_exit_codes: [0] - end + # The omnibus installer use the following algorithm to know what to do. + # https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/files/gitlab-cookbooks/runit/recipes/default.rb + # If this peace of code trigger docker case, the installer hang indefinitly. + pp = %( + file {'/.dockerenv': + ensure => absent, + } + package { ['curl']: + ensure => present, + } + ) + + apply_manifest(pp, catch_failures: true) + apply_manifest(pp, catch_changes: true) end end