Skip to content
This repository was archived by the owner on Apr 8, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
pkg
.vagrant
.gitreview

Gemfile.lock

kitchenci/.tmp/
kitchenci/modules/
kitchenci/*.lock
kitchenci/.ruby*
kitchenci/.kitchen
kitchenci/.librarian
24 changes: 24 additions & 0 deletions kitchenci/.kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
driver:
name: vagrant

provisioner:
name: puppet_apply
puppet_version: {puppet_version}
mainfests_path: manifests
modules_path: modules
hiera_config_path: hiera.yaml
hiera_data_path: hieradata

platforms:
{platforms}
driver:
customize:
memory: 4096

suites:
- name: default
manifest: site.pp
provisioner:
custom_facts:
processorcount: 2
8 changes: 8 additions & 0 deletions kitchenci/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# A sample Gemfile
source "https://rubygems.org"

gem "test-kitchen"
gem "kitchen-puppet"
gem "kitchen-docker"
gem "kitchen-vagrant"
gem "librarian-puppet"
8 changes: 8 additions & 0 deletions kitchenci/Puppetfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Role specific modules

forge "https://forgeapi.puppetlabs.com"

mod "cakesolutions/cassandra",
:git => "git@github.com:cakesolutions/puppet-cassandra.git"

mod "puppetlabs/stdlib", "4.6.0"
7 changes: 7 additions & 0 deletions kitchenci/hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
:backends:
- yaml
:yaml:
:datadir: /tmp/kitchen/hiera
:hierarchy:
- common
34 changes: 34 additions & 0 deletions kitchenci/hieradata/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
cassandra::version: "4.7.0-1"
cassandra::opscenter_version: "5.1.3-1"
cassandra::using_dse: true
cassandra::config_path: /etc/dse/cassandra
cassandra_home: /var/lib/cassandra
cassandra_home_mode: 755
cassandra::service_name: "dse"
cassandra::package_name: "dse-full"
cassandra::repo_baseurl: "http://auto_cakesolutions.net:T4MAbMsNBvtlSKu@rpm.datastax.com/enterprise"
cassandra::seeds: [ "%{::ipaddress_eth0}" ]
cassandra::listen_address: "%{::ipaddress_eth0}"
cassandra::broadcast_address: "%{hiera('cassandra::listen_address')}"
cassandra::rpc_address: '0.0.0.0'
cassandra::broadcast_rpc_address: "%{hiera('cassandra::broadcast_address')}"
cassandra::cluster_name: 'testCassandra'
cassandra::endpoint_snitch: "SimpleSnitch"
cassandra::dse_audit_logging_enabled: true
cassandra::dse_audit_logger: "SLF4JAuditWriter"
cassandra::dse_audit_included_categories: "ADMIN, AUTH, QUERY"
cassandra::service_enable: "true"
cassandra::service_ensure: "running"
cassandra::opscenter_service_enable: "true"
cassandra::opscenter_service_ensure: "running"
cassandra::cassandra_seed_hosts: "%{::seed_a_eni_ip},%{::seed_b_eni_ip},%{::seed_c_eni_ip}"
cassandra::datastax_agent_stomp_interface: "%{::ipaddress}"
cassandra::datastax_agent_additional_jvm_opts:
- "-Dorg.xerial.snappy.tempdir=/var/lib/datastax-agent/"
- "-Djava.io.tmpdir=/var/lib/datastax-agent/"
cassandra::additional_jvm_opts:
- "-Dorg.xerial.snappy.tempdir=/var/lib/cassandra/"
- "-Dcom.sun.management.jmxremote.rmi.port=48888"
- "-Djava.io.tmpdir=/var/lib/cassandra/"
- "-Dconsistent.rangemovement=false"
1 change: 1 addition & 0 deletions kitchenci/manifests/site.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include cassandra
119 changes: 119 additions & 0 deletions kitchenci/test/integration/default/serverspec/conf_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
require 'serverspec'

set :backend, :exec

## checking successfull puppet run
describe command('grep fail /var/lib/puppet/state/last_run_summary.yaml |grep -v "fail.*:\ 0”') do
its(:exit_status) { should eq 1 }
end

describe user('cassandra') do
it { should exist }
end

describe group('cassandra') do
it { should exist }
end

describe file('/var/lib/cassandra/data') do
it { should be_directory }
it { should be_mode 644 }
it { should be_owned_by 'cassandra' }
it { should be_grouped_into 'cassandra' }
end

describe file('/etc/dse/cassandra/cassandra-env.sh') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'cassandra' }
it { should be_grouped_into 'cassandra' }
its(:content) { should match /JVM_OPTS=\"\$JVM_OPTS -Dorg.xerial.snappy.tempdir=\/var\/lib\/cassandra\/\"/ }
its(:content) { should match /JVM_OPTS=\"\$JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=48888\"/ }
its(:content) { should match /JVM_OPTS=\"\$JVM_OPTS -Djava.io.tmpdir=\/var\/lib\/cassandra\/\"/ }
its(:content) { should match /JVM_OPTS=\"\$JVM_OPTS -Dconsistent.rangemovement=false/ }
its(:content) { should match /JMX_PORT=\"7199\"/ }
end

describe file('/etc/dse/cassandra/cassandra.yaml') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'cassandra' }
it { should be_grouped_into 'cassandra' }
its(:content) { should match /cluster_name: 'testCassandra'/}
its(:content) { should match /num_tokens: 256/}
its(:content) { should match /initial_token: /}
its(:content) { should match /authenticator: AllowAllAuthenticator/}
its(:content) { should match /authorizer: AllowAllAuthorizer/}
its(:content) { should match /partitioner: org.apache.cassandra.dht.Murmur3Partitioner/}
its(:content) { should match /- \/var\/lib\/cassandra\/data/}
its(:content) { should match /commitlog_directory: \/var\/lib\/cassandra\/commitlog/}
its(:content) { should match /disk_failure_policy: stop/}
its(:content) { should match /saved_caches_directory: \/var\/lib\/cassandra\/saved_caches/}
its(:content) { should match /seeds: 10.0.2.15/} #::ipaddress_eth0
its(:content) { should match /concurrent_reads: 16/} # $::processorcount * 8 ==> 16
its(:content) { should match /concurrent_writes: 16/} # $::processorcount * 8 ==> 16
its(:content) { should match /storage_port: 7000/}
its(:content) { should match /listen_address: 10.0.2.15/} #::ipaddress_eth0
its(:content) { should match /broadcast_address: 10.0.2.15/} #::ipaddress_eth0
its(:content) { should match /start_native_transport: true/}
its(:content) { should match /native_transport_port: 9042/}
its(:content) { should match /start_rpc: true/}
its(:content) { should match /rpc_port: 9160/}
its(:content) { should match /broadcast_rpc_address: 10.0.2.15/} #::ipaddress_eth0
its(:content) { should match /rpc_server_type: hsha/}
its(:content) { should match /rpc_min_threads: 0/}
its(:content) { should match /rpc_max_threads: 2048/}
its(:content) { should match /incremental_backups: false/}
its(:content) { should match /snapshot_before_compaction: false/}
its(:content) { should match /auto_snapshot: true/}
its(:content) { should match /endpoint_snitch: SimpleSnitch/}
### server_encryption_options:
its(:content) { should match /internode_encryption: none/}
its(:content) { should match /keystore: /}
its(:content) { should match /keystore_password: /}
its(:content) { should match /require_client_auth: false/}
its(:content) { should match /truststore: /}
its(:content) { should match /truststore_password: /}
its(:content) { should match /protocol: TLS/}
its(:content) { should match /algorithm: SunX509/}
its(:content) { should match /store_type: JKS/}
###client_encryption_options:
its(:content) { should match /enabled: false/}
its(:content) { should match /keystore: /}
its(:content) { should match /keystore_password: /}
its(:content) { should match /require_client_auth: false/}
its(:content) { should match /protocol: TLS/}
its(:content) { should match /algorithm: SunX509/}
its(:content) { should match /store_type: JKS/}
end

describe file('/etc/dse/dse.yaml') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'cassandra' }
it { should be_grouped_into 'cassandra' }
### Audit logging options
its(:content) { should match /enabled: true/}
its(:content) { should match /logger: SLF4JAuditWriter/}
its(:content) { should match /included_categories: ADMIN, AUTH, QUERY/}
its(:content) { should match /# excluded_categories:/}
its(:content) { should match /# included_keyspaces:/}
its(:content) { should match /# excluded_keyspaces:/}
end

describe file('/etc/datastax-agent/datastax-agent-env.sh') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'cassandra' }
it { should be_grouped_into 'cassandra' }
its(:content) { should match /JVM_OPTS=\"\$JVM_OPTS -Dorg.xerial.snappy.tempdir=\/var\/lib\/datastax-agent\/\"/ }
its(:content) { should match /JVM_OPTS=\"\$JVM_OPTS -Djava.io.tmpdir=\/var\/lib\/datastax-agent\/\"/}
end

describe file('/var/lib/datastax-agent/conf/address.yaml') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'cassandra' }
it { should be_grouped_into 'cassandra' }
its(:content) { should match /stomp_interface: 10.0.2.15/} #::ipaddress_eth0
end
22 changes: 22 additions & 0 deletions kitchenci/test/integration/default/serverspec/install_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'serverspec'

set :backend, :exec

## checking successfull puppet run
describe command('grep fail /var/lib/puppet/state/last_run_summary.yaml |grep -v "fail.*:\ 0”') do
its(:exit_status) { should eq 1 }
end

## java_package is defined twice in params.pp of puppet-cassandra module with two different values,
## seems like java-1.7.0-openjdk is the correct default value not openjdk-7-jre
describe package('java-1.7.0-openjdk') do
it { should be_installed.by('rpm') }
end

describe package('dse-full') do
it { should be_installed.by('rpm').with_version('4.7.0-1') }
end

describe package('python26-cql') do
it { should be_installed.by('rpm') }
end
21 changes: 21 additions & 0 deletions kitchenci/test/integration/default/serverspec/repo_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require 'serverspec'

set :backend, :exec

## checking successfull puppet run
describe command('grep fail /var/lib/puppet/state/last_run_summary.yaml |grep -v "fail.*:\ 0”') do
its(:exit_status) { should eq 1 }
end

## check Cassandra repo
describe yumrepo('datastax') do
it { should exist }
it { should be_enabled }
end

#TODO: add matches for the rest of repo file content
describe file('/etc/yum.repos.d/datastax.repo') do
it { should be_file }
its(:content) { should match /baseurl=http:\/\/auto_cakesolutions.net:T4MAbMsNBvtlSKu@rpm.datastax.com\/enterprise/ }
its(:content) { should match /gpgcheck=0/ }
end
18 changes: 18 additions & 0 deletions kitchenci/test/integration/default/serverspec/service_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'serverspec'

set :backend, :exec

## checking successfull puppet run
describe command('grep fail /var/lib/puppet/state/last_run_summary.yaml |grep -v "fail.*:\ 0”') do
its(:exit_status) { should eq 1 }
end

describe service('dse') do
it { should be_enabled }
it { should be_running }
end

describe service('datastax-agent') do
it { should be_enabled }
it { should be_running }
end
14 changes: 7 additions & 7 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -168,38 +168,38 @@
content => template("${module_name}/dse.yaml.erb"),
}

file { "/etc/datastax-agent/datastax-agent-env.sh":
file { '/etc/datastax-agent/datastax-agent-env.sh':
ensure => file,
content => template("${module_name}/datastax-agent-env.sh.erb"),
notify => Service['datastax-agent'],
}

file { "/var/lib/datastax-agent/conf/address.yaml":
file { '/var/lib/datastax-agent/conf/address.yaml':
ensure => file,
content => template("${module_name}/address.yaml.erb"),
notify => Service['datastax-agent'],
}
}

if(($dse_audit_logging_enabled) and ($dse_audit_logger=="Log4JAuditWriter")) {
if(($dse_audit_logging_enabled) and ($dse_audit_logger=='Log4JAuditWriter')) {
file { "${dse_config_path}/cassandra/log4j-server.properties":
ensure => file,
content => template("${module_name}/log4j-server.properties.erb"),
}
}

if($using_opscenter) {
file { "/etc/opscenter/opscenterd.conf":
file { '/etc/opscenter/opscenterd.conf':
ensure => file,
owner => opscenter,
group => opscenter,
content => template("${module_name}/opscenterd.conf.erb"),
}

file { "/etc/opscenter/clusters":
file { '/etc/opscenter/clusters':
ensure => directory,
owner => opscenter,
group => opscenter,
owner => opscenter,
group => opscenter,
}

file { "/etc/opscenter/clusters/${cluster_name}.conf":
Expand Down
12 changes: 6 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,12 @@
validate_re($snapshot_before_compaction, '^(true|false)$')
validate_re($auto_snapshot, '^(true|false)$')
validate_re($multithreaded_compaction, '^(true|false)$')
validate_re("${concurrent_reads}", '^[0-9]+$')
validate_re("${concurrent_writes}", '^[0-9]+$')
validate_re("${num_tokens}", '^[0-9]+$')
validate_re($concurrent_reads, '^[0-9]+$')
validate_re($concurrent_writes, '^[0-9]+$')
validate_re($num_tokens, '^[0-9]+$')
validate_re($internode_compression, '^(all|dc|none)$')
validate_re($disk_failure_policy, '^(stop|best_effort|ignore)$')
validate_re("${thread_stack_size}", '^[0-9]+$')
validate_re($thread_stack_size, '^[0-9]+$')
validate_re($service_enable, '^(true|false)$')
validate_re($service_ensure, '^(running|stopped)$')

Expand Down Expand Up @@ -237,7 +237,7 @@
if(!is_integer($datastax_agent_use_ssl)) {
fail('datastax_agent_use_ssl must be a nuber between 0 and 1')
}
validate_re("$datastax_agent_use_ssl", '^[0-1]$')
validate_re($datastax_agent_use_ssl, '^[0-1]$')
validate_string($datastax_agent_ssl_keystore)
validate_string($datastax_agent_ssl_keystore_password)
validate_string($datastax_agent_ssl_ca_certs)
Expand Down Expand Up @@ -296,7 +296,7 @@
validate_string($dse_audit_included_categories)
validate_string($dse_audit_excluded_categories)
validate_string($dse_audit_included_keyspaces)
validate_string($dse_audit_excluded_keyspaces)
validate_string($dse_audit_excluded_keyspaces)
}


Expand Down
4 changes: 2 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

if !defined (Package['java']) {
package { 'java':
ensure => installed,
name => "$java_package"
ensure => installed,
name => $java_package
}
}

Expand Down
Loading