Setup preconditions for acceptance tests.
We split the definition of the module under test from its preconditions. This behaviour was identified while testing puppet-zuul. To keep it consistent across projects, we decided to also apply the same logic on this module. Change-Id: I0b9014ce6470d5c142ab6a3b281ea7401f88e738 Co-Authored-By: Bruno Tavares <btavare@thoughtworks.com> Co-Authored-By: Danilo Ramalho <dramalho@thoughtworks.com>
This commit is contained in:
		
				
					committed by
					
						
						Danilo Ramalho
					
				
			
			
				
	
			
			
			
						parent
						
							414b66a740
						
					
				
				
					commit
					f36dd91325
				
			
							
								
								
									
										3
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Gemfile
									
									
									
									
									
								
							@@ -30,6 +30,9 @@ end
 | 
			
		||||
 | 
			
		||||
group :system_tests do
 | 
			
		||||
  gem 'beaker-rspec', :require => false
 | 
			
		||||
  # Workaround for fog-google requiring ruby 2.0 on latest version
 | 
			
		||||
  # https://github.com/fog/fog-google/commit/a66b16fa7c2373f9c8be2e80bc942ad8d13ece3f
 | 
			
		||||
  gem 'fog-google', '0.1.0'
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
# vim:ft=ruby
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,8 @@ describe 'basic gerrit' do
 | 
			
		||||
      File.join(base_path, 'fixtures')
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def ssh_keygen_puppet_module
 | 
			
		||||
      module_path = File.join(pp_path, 'ssh_keygen.pp')
 | 
			
		||||
    def preconditions_puppet_module
 | 
			
		||||
      module_path = File.join(pp_path, 'preconditions.pp')
 | 
			
		||||
      File.read(module_path)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
@@ -18,7 +18,7 @@ describe 'basic gerrit' do
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    before(:all) do
 | 
			
		||||
      apply_manifest(ssh_keygen_puppet_module, catch_failures: true)
 | 
			
		||||
      apply_manifest(preconditions_puppet_module, catch_failures: true)
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'should work with no errors' do
 | 
			
		||||
 
 | 
			
		||||
@@ -1,18 +1,3 @@
 | 
			
		||||
# workaround since ssl-cert group is not being installed as part of
 | 
			
		||||
# this module
 | 
			
		||||
package { 'ssl-cert':
 | 
			
		||||
  ensure => present,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exec { 'ensure ssl-cert exists':
 | 
			
		||||
  command => '/usr/sbin/groupadd -f ssl-cert'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# workaround since pip is not being installed as part of this module
 | 
			
		||||
package { 'python-pip':
 | 
			
		||||
  ensure => present,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
class { '::gerrit::mysql':
 | 
			
		||||
  mysql_root_password => 'UNSET',
 | 
			
		||||
  database_name       => 'reviewdb',
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,8 @@
 | 
			
		||||
# Installing ssl-cert in order to get snakeoil certs
 | 
			
		||||
package { 'ssl-cert':
 | 
			
		||||
  ensure => present,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# method to create ssh directory
 | 
			
		||||
define create_ssh_key_directory() {
 | 
			
		||||
  Exec { path => '/bin:/usr/bin' }
 | 
			
		||||
@@ -21,7 +26,19 @@ define ssh_keygen (
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$ssh_key_directory = '/tmp/gerrit-ssh-keys'
 | 
			
		||||
create_ssh_key_directory { $ssh_key_directory: }
 | 
			
		||||
ssh_keygen {'ssh_rsa_key': ssh_directory => $ssh_key_directory }
 | 
			
		||||
ssh_keygen {'ssh_project_rsa_key': ssh_directory => $ssh_key_directory }
 | 
			
		||||
ssh_keygen {'ssh_replication_rsa_key': ssh_directory => $ssh_key_directory }
 | 
			
		||||
file { $ssh_key_directory:
 | 
			
		||||
  ensure => directory,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ssh_keygen {'ssh_rsa_key':
 | 
			
		||||
  ssh_directory => $ssh_key_directory,
 | 
			
		||||
  require       => File[$ssh_key_directory],
 | 
			
		||||
}
 | 
			
		||||
ssh_keygen {'ssh_project_rsa_key':
 | 
			
		||||
  ssh_directory => $ssh_key_directory,
 | 
			
		||||
  require       => File[$ssh_key_directory],
 | 
			
		||||
}
 | 
			
		||||
ssh_keygen {'ssh_replication_rsa_key':
 | 
			
		||||
  ssh_directory => $ssh_key_directory,
 | 
			
		||||
  require       => File[$ssh_key_directory],
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user