diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9e24c36 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,70 @@ +--- +jobs: + build: + docker: + - + environment: + PUPPET_VERSION: "~> 3.8" + STRICT_VARIABLES: true + image: "ruby:2.1.9" + steps: + - checkout + - + restore_cache: + keys: + - "projectname-{{ .Branch }}-{{ checksum \"Gemfile\" }}" + - "projectname-{{ .Branch }}" + - projectname-master + - + run: + command: "bundle install --without development acceptance --path vendor/bundle" + name: "Bundle Install" + - + run: + command: "bundle clean --force" + name: "Bundle Cleanup" + - + save_cache: + key: "projectname-{{ .Branch }}-{{ checksum \"Gemfile\" }}" + paths: + - vendor/bundle + - + run: + command: "bundle clean --force" + name: "Bundle Cleanup" + - + run: + command: "bundle exec puppet --version" + name: "Show Puppet version" + - + run: + command: "bundle exec travis-lint" + name: "TravisCI Lint" + - + run: + command: "bundle exec rake metadata_lint" + name: "Puppet Metadata Lint" + - + run: + command: "bundle exec rake lint" + name: "Puppet Lint" + - + run: + command: "bundle exec rake validate" + name: "Validate the Puppet code" + - + run: + command: "bundle exec rake spec SPEC_OPTS=\"--format documentation --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/rspec/puppet.xml\"" + name: "Spec tests" + - + deploy: + name: Deploy from master + command: | + if [ "${CIRCLE_BRANCH}" == "master" -a -z "${RUN_NIGHTLY_BUILD}" ]; then + git config --global user.email "info@locp.co.uk" + git config --global user.name "CircleCI" + bundle exec rake strings:gh_pages:update + bundle exec rake deploy + fi + working_directory: ~/cassandra +version: 2 diff --git a/.rubocop.yml b/.rubocop.yml index 0323ff5..c9c7f48 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,13 +1,15 @@ --- AllCops: Exclude: - 'vagrant/modules/*/Gemfile' - 'vagrant/modules/*/Rakefile' - 'vagrant/modules/**/*' - 'vendor/**/*' Metrics/BlockLength: Enabled: false +Metrics/ClassLength: + Enabled: false Metrics/LineLength: Enabled: false -Style/FrozenStringLiteralComment: +Metrics/MethodLength: Enabled: false diff --git a/.travis.yml b/.travis.yml index 948d8df..a33cd3e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,30 @@ --- env: - - "PUPPET_VERSION='~> 4.5' BEAKER_set=centos6" + - "PUPPET_VERSION='~> 4.5' BEAKER_set=centos6_2" + - "PUPPET_VERSION='~> 4.5' BEAKER_set=centos6_3" - "PUPPET_VERSION='~> 4.5' BEAKER_set=centos7" - "PUPPET_VERSION='~> 4.5' BEAKER_set=debian7" - "PUPPET_VERSION='~> 4.5' BEAKER_set=debian8" - "PUPPET_VERSION='~> 4.5' BEAKER_set=ubuntu1204" - "PUPPET_VERSION='~> 4.5' BEAKER_set=ubuntu1404" - "PUPPET_VERSION='~> 4.5' BEAKER_set=ubuntu1604" language: ruby rvm: - 2.3.1 cache: bundler before_install: rm Gemfile.lock || true bundler_args: --without development dist: trusty sudo: required script: - "bundle exec puppet --version" - "bundle exec rake metadata_lint" - "bundle exec rubocop" - "bundle exec rake lint" - "bundle exec rake validate" - "bundle exec rake spec SPEC_OPTS='--format documentation'" - - travis_wait 40 "bundle exec rake acceptance" + - "bundle exec rake acceptance" notifications: email: false matrix: fast_finish: true diff --git a/CHANGELOG.md b/CHANGELOG.md index adb2164..ce5680d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,1106 +1,1117 @@ # Change Log for Puppet Module locp-cassandra +##2017-04-24 - Release 2.4.1 ([diff](https://github.com/locp/cassandra/compare/2.4.0...2.4.1)) + +### Summary + +A non-functional release of improvements. + +### Improvements + +* A refactoring and extension of the acceptance tests. +* Migrated from version 1.0 to 2.0 of the CircleCI API. + ##2017-03-30 - Release 2.4.0 ([diff](https://github.com/locp/cassandra/compare/2.3.0...2.4.0)) ### Summary * Added the `cassandra::dse` class to 2.X.Y of the module. * Added the new `cassandra::apache_repo` class. * Minor bug fixes and improvements. ##2017-02-28 - Release 1.27.0 ([diff](https://github.com/locp/cassandra/compare/1.26.1...1.27.0)) ### Summary Add the `cassandra::dse` class. ##2017-01-21 - Release 2.3.0 ([diff](https://github.com/locp/cassandra/compare/2.2.1...2.3.0)) New attribute to `::cassandra` class: * `baseline_settings` New defined types: * `cassandra::system::swapoff` * `cassandra::system::sysctl` * `cassandra::system::transparent_hugepage` ##2016-12-08 - Release 2.2.1 ([diff](https://github.com/locp/cassandra/compare/2.2.0...2.2.1)) ### Summary Non-functional improvements and some documentation fixes. ### Improvements * All beaker spec tests have been migrated from AWS/EC2 to Docker. * Installed Python 2.7 onto the CentOS 6 docker image allowing the full test suite to be run against that operating system. * Some documentation improvements and fixed some typos. * The spec tests will now fail if there is not 100% coverage. ##2016-12-01 - Release 2.2.0 ([diff](https://github.com/locp/cassandra/compare/2.1.2...2.2.0)) ### Summary At long last we have a defined type for handling permissions (something that we have been promising since May). Added some more facts for assisting in JVM tuning. Also fixed an error that was happening when attempting to build the project. ### Features * Added the `permissions` attribute to the `cassandra::schema` class. * Added the `cassandra::schema::permission` ### Bugfixes * Some refactoring of the ruby code since the release of Rubocop 0.46.0 which was failing code that previously had passed OK. ##2016-11-02 - Release 2.1.2 ([diff](https://github.com/locp/cassandra/compare/2.1.1...2.1.2)) ### Summary Basically a non-functional release to reduce some of the technical debt from the 2.0.0 release. Also some minor improvements to the documentation. ##2016-11-19 - Release 1.26.1 ([diff](https://github.com/locp/cassandra/compare/1.26.0...1.26.1)) ### Summary Retro-fitted a bug that was fixed in 2.1.1 into the 1.X.Y version of the module. ### Bugfixes * A hotfix for a bug in `cassandra::schema` that has been around since version 1.18.0 of this module. ##2016-11-02 - Release 2.1.1 ([diff](https://github.com/locp/cassandra/compare/2.1.0...2.1.1)) ### Summary A hotfix for a bug in `cassandra::schema` that has been around since version 1.18.0 of this module. ### Bugfixes * Fixed a bug where cql_types would not be created unless keyspaces were also provided. * Fixed a minor typo in the README. ##2016-10-29 - Release 2.1.0 ([diff](https://github.com/locp/cassandra/compare/2.0.2...2.1.0)) ### Summary A mixture of new features, a new style of documentation and other improvements. Also ran the [Sonar-Puppet](https://github.com/iwarapter/sonar-puppet) plugin against the code to improve the code quality. ### Features * The following facts are now available: * cassandramajorversion * cassandraminorversion * cassandrapatchversion * cassandrarelease * The following attributes are now available: * cassandra::commitlog_directory * cassandra::commitlog_directory_mode * cassandra::data_file_directories * cassandra::data_file_directories_mode * cassandra::hints_directory * cassandra::hints_directory_mode * cassandra::saved_caches_directory * cassandra::saved_caches_directory_mode * cassandra::systemctl ### Bugfixes * Resolved all issues identified by Sonar-Puppet from 38 (2 major, 36 minor). In doing so, this reduced the technical debt ration from 0.9% to 0.0%. ### Improvements -* The reference documentation is now processed via +* The reference documentation is now processed via http://locp.github.io/cassandra * Made a start on refactoring the spec/unit tests so that there is less duplication of code. ##2016-10-12 - Release 2.0.2 ([diff](https://github.com/locp/cassandra/compare/2.0.1...2.0.2)) ### Summary This is a non-functional patch release that fixes some issues in documentation, and fixes some bugs and makes some improvements in our testing framework. ### Improvements * Ensure there is a framework for supporting the legacy 1.X.Y. module until the end of 2016. * A more obvious test rig for the beaker/acceptance tests on TravisCI. ### Bugfixes * Corrected misleading documentation. * Ensure legacy test builds still work against Ruby 1.9.3. * Corrected deprecated tags in the module metadata. ##2016-10-08 - Release 1.26.0 ([diff](https://github.com/locp/cassandra/compare/1.25.2...1.26.0)) ### Improvements * The `cassandra::seeds` paramater can now be provided as an array or as a string. # Bugfixes * Ensure legacy builds still work on TravisCI. ##2016-10-01 - Release 2.0.1 ([diff](https://github.com/locp/cassandra/compare/2.0.0...2.0.1)) ### Summary A non-functional release containing some improvements and documentation corrections. ### Improvements * Corrected some out of date documentation. * Removed some deprecated files. * Regained 100% spec test coverage. ##2016-09-29 - Release 2.0.0 ([diff](https://github.com/locp/cassandra/compare/1.26.0...2.0.0)) ### Summary This is a major release and will more than likely break your existing manifest until you alter your code. Please see the [Upgrading](https://github.com/locp/cassandra/tree/release/274/v2.0.0#upgrading) section of the README for further details. * The method of passing parameters to Cassandra has been made more flexible. * Support for Ubuntu 16.04. * Changes to how `service_ensure` is handled. * `cassandra::file` is now a define, not a class (as it should have been). ##2016-09-03 - Release 1.25.2 ([diff](https://github.com/locp/cassandra/compare/1.25.1...1.25.2)) ### Summary The `service_systemd` attribute is now deprecated for the `cassandra`, `cassandra::datastax_agent` and `cassandra::opscenter` classes. See https://github.com/locp/cassandra/wiki/DEP-020 for more details. ##2016-08-14 - Release 1.25.1 ([diff](https://github.com/locp/cassandra/compare/1.25.0...1.25.1)) ### Summary Bugfix to ensure that the name of the PID file for the DataStax Agent service matches with the service name. ##2016-07-17 - Release 1.25.0 ([diff](https://github.com/locp/cassandra/compare/1.24.3...1.25.0)) ### Summary A feature release. ### Features * The `cassandra` class now has a `disk_access_mode` attribute. ##2016-06-26 - Release 1.24.3 ([diff](https://github.com/locp/cassandra/compare/1.24.2...1.24.3)) ### Summary A couple of non-functional bug fixes. ### Bugfixes * The new version of RuboCop flagged code changes required in the Vagrantfile. * The new version of Puppet Lint flagged code changes required in cassandra::java. ##2016-06-20 - Release 1.24.2 ([diff](https://github.com/locp/cassandra/compare/1.24.1...1.24.2)) ### Summary A non-functional bug fix. ### Bugfixes * The release of the specinfra gem (2.59.1) caused problems with our build. Pinned now to 2.59.0. ##2016-06-18 - Release 1.24.1 ([diff](https://github.com/locp/cassandra/compare/1.24.0...1.24.1)) ### Summary Really only affects CentOS 7 as all the other supported operating systems do not require the systemd file to be installed. ### Bugfixes * Change the way that systemd shuts Cassandra down. ##2015-05-25 - Release 1.24.0 ([diff](https://github.com/locp/cassandra/compare/1.23.1...1.24.0)) ### Summary A Debian-centric release. Debian 8 is now supported and a workaround for [CASSANDRA-2356](https://issues.apache.org/jira/browse/CASSANDRA-2356) (which only affects Debian. ### Features * New attributes to the `::cassandra` class are: * cassandra_2356_sleep_seconds * config_path_parents * rackdc_tmpl ### Bugfixes * CASSANDRA-2356 ### Improvements * Debian 8 is now part of the acceptance testing release process. ##2016-05-10 - Release 1.23.1 ([diff](https://github.com/locp/cassandra/compare/1.23.0...1.23.1)) ### Summary A minor bugfix that fixes a problem that would only affect module developers, not users of the module. ### Bugfixes * Rubocop 0.4.0 is stricter so implemented changes that were flagged by it. ##2016-05-07 - Release 1.23.0 ([diff](https://github.com/locp/cassandra/compare/1.22.1...1.23.0)) ### Summary A couple of new features, a non-functional improvement and a bugfix. ### Features * Added the cassandra::file class. * Added the following attributes to the cassandra::schema class: * cqlsh_client_tmpl * cqlsh_client_config ### Bugfixes * Fixed a daft error that stopped beaker tests running on CentOS 7. ### Improvements * Improved how fast the beaker/acceptance tests are run from TravisCI. ##2016-05-03 - Release 1.22.1 ([diff](https://github.com/locp/cassandra/compare/1.22.0...1.22.1)) ### Summary A non-functional release for a minor improvement and a bug fix. ### Bugfixes * Fixes a problem with resource ordering if the service_refresh attribute is set to false. ### Improvements * Test coverage in Coveralls is now back at 100% (https://coveralls.io/github/locp/cassandra). ##2016-04-25 - Release 1.22.0 ([diff](https://github.com/locp/cassandra/compare/1.21.0...1.22.0)) ### Summary Two new features. ### Features * Allow the creation and dropping of users with the following: * A new defined type cassandra::schema::user * The new attribute cassandra::schema::users * Allow the manipulation of the environment file with the new class cassandra::env. ##2016-04-20 - Release 1.21.0 ([diff](https://github.com/locp/cassandra/compare/1.20.0...1.21.0)) ### Summary Some minor bug fixes. Also some features and improvements that allow acceptance tests to be run against Cassandra 3. ### Features * Added the following attributes to cassandra::java: * aptkey * aptsource * yumrepo ### Bugfixes * Corrected some errors in the README and CHANGELOG. * Fixed problems with TravisCI builds. * Fixed problems with CircleCI builds. ### Improvements * Acceptance testing of Cassandra 3. ##2016-04-13 - Release 1.20.0 ([diff](https://github.com/locp/cassandra/compare/1.19.0...1.20.0)) ### Summary A minor release for client requirements. ### Features * Added the compaction_large_partition_warning_threshold_mb and memtable_allocation_type attributes to the cassandra class. ##2016-04-06 - Release 1.19.0 ([diff](https://github.com/locp/cassandra/compare/1.18.1...1.19.0)) ### Summary A new template attribute and a couple of bug fixes. ### Features * The hints_directory attribute has been added to the cassandra class for placing into the template. ### Bugfixes * Some documentation errors that had been identified have been resolved. * A problem with OpsCenter and systemd has been resolved. So far only CentOS 7 from the supported operating systems has been identified as being required to use systemd. ##2016-03-27 - Release 1.18.1 ([diff](https://github.com/locp/cassandra/compare/1.18.0...1.18.1)) ### Summary Bug fixes and some minor and non-functional improvements. ### Bugfixes * Resource ordering clarified in the cassandra::schema class. * The cqlsh command now attempts to connect to rpc_address, not the listen_address. ### Improvements * Optimised the CircleCI build process. * Made some changes to the documentation to better reflect the new functionality delivered in 1.18.0. ##2016-03-26 - Release 1.18.0 ([diff](https://github.com/locp/cassandra/compare/1.17.0...1.18.0)) ### Summary Some more functionality and sub-classes for cassandra::schema. Also some code and pipe-line improvements and a couple of bug fixes. ### Features * The cassandra::schema class now has the following additional attributes: * cql_types * indexes * tables There are also corresponting defined types for those attributes: * cassandra::schema::cql_type * cassandra::schema::index * cassandra::schema::table * The cassandra::opscenter class now has a new attribute called ldap_group_search_filter_with_dn. ### Bugfixes * In the firewalls class, an OpsCenter server also needs to connect to the Cassandra node it is monitoring as a client. The ports have been adjusted to allow this to happen. * rspec-puppet version 2.4.0 was breaking our builds so pegged ourselves to 2.3.2. ### Improvements * Some minor and non-functional improvements to the build pipe-line. * Carried out an audit using the Puppet plugin for SonarQube. The number of issues has been reduced from 227 (13 major, 214 minor) to 4 major issues of which 2 are false positives. The remaining issues will be resolved in 2.0.0. ##2016-03-22 - Release 1.17.0 ([diff](https://github.com/locp/cassandra/compare/1.16.0...1.17.0)) ### Summary Another small change that is an emergency requirement for a client. ### Features * Added the `storage_keyspace` attribute to the cassandra::datastax_agent class. ##2016-03-15 - Release 1.16.0 ([diff](https://github.com/locp/cassandra/compare/1.15.1...1.16.0)) ### Summary A smaller release than usual, but containing changes required for a client. ### Features * Added the `hosts` attribute to the cassandra::datastax_agent class. ### Bugfixes * The **address.yaml** file for the DataStax agent is now owned by the cassandra user. ##2016-03-11 - Release 1.15.1 ([diff](https://github.com/locp/cassandra/compare/1.15.0...1.15.1)) ### Summary A small improvement. ### Improvements * Clarified CQL and Python versions. ##2016-03-10 - Release 1.15.0 ([diff](https://github.com/locp/cassandra/compare/1.14.2...1.15.0)) ### Summary A rather large release. Minor (non-functional) fixes to the production pipeline and new features. ### Features * A new class `cassandra::schema` allows the creation and dropping of keyspaces. * Added the `additional_lines` attribute to the `cassandra` class. * Added the `service_systemd` attribute to the `cassandra::opscenter` class. * Allow the systemd template sources to be specified by the user. This is with the `service_systemd_tmpl` attribute to the following classes: * cassandra * cassandra::datastax_agent * cassandra::opscenter * Added another template file for `cassandra` => `service_systemd_tmpl` that is suitable for Cassandra 2.0. ### Bugfixes * Worked around a problem with rake-11 in the Gemfile. * Fixed a problem in the CircleCI configuration. ### Improvements * Renamed the `ensure` attribute to `package_ensure` so that it is more in line with how it's called in other modules. This was done on the the following classes: * cassandra::optutils * cassandra::opscenter * cassandra::opscenter::pycrypto * cassandra::java * Updated the AWS AMI for the TravisCI/AWS acceptance testing to hopefully speed up builds a bit. ##2016-02-29 - Release 1.14.2 ([diff](https://github.com/locp/cassandra/compare/1.14.1...1.14.2)) ### Summary A small bugfix release. ### Bugfixes * Removed `Restart=always` from the Systemd configuration files. ##2016-02-27 - Release 1.14.1 ([diff](https://github.com/locp/cassandra/compare/1.14.0...1.14.1)) ### Summary A non-functional release of improvements and a bugfix. ### Bugfixes * If a systemd service file is created or updated, then systemctl daemon-reload is now be executed. ### Improvements * The workflow for building the module has been improved to include: * Automatic integration of improvements and bugfixes into release candidates. * Testing of release candidates includes acceptance (beaker) as well as unit (spec) tests. * The refactoring of the majority of the Ruby code used to test and build this module so that it is hopefully more readable and easier to maintain. * The automation of what had previously been manual steps when building a release. ##2016-02-19 - Release 1.14.0 ([diff](https://github.com/locp/cassandra/compare/1.13.0...1.14.0)) ### Summary A minor release with one of each of a feature, bug fix and improvement. ### Features * Added the orbited_longpoll attribute to the cassandra::opscenter class. ### Bugfixes * Fixed a problem with the DataStax agent and systemd. ### Improvements * Refactored the contributors section of the README. ##2016-02-14 - Release 1.13.0 ([diff](https://github.com/locp/cassandra/compare/1.12.2...1.13.0)) ### Summary A mixed back of new features in the shape of attributes for the cassandra, cassandra::datastax_agent and cassandra::opscenter classes. A couple of bug fixes and some non-functional improvements. ### Features * Added the thrift_framed_transport_size_in_mb attribute to ::cassandra. * Added the following attributes to ::cassandra::datastax_agent: * async_pool_size * async_queue_size * service_systemd * Added the config_purge attribute to ::cassandra::opscenter. ### Bugfixes * Removed incorrect puppet code from the README examples. * Fixed a problem with the beaker 2.34.0 gem which was causing problems during automated acceptance testing. ### Improvements * Changed the AWS instance type used by the TravisCI triggered acceptance tests from a c3.xlarge to c4.xlarge. * Merged the acceptance tests virtual nodes into family specific node sets. * Refactored the Gemfile. * Changed references in the documentation to parameters to refer to attributes as that is more Puppet-like. * Changed the format of the contributers section. ##2016-02-12 - Release 1.12.2 ([diff](https://github.com/locp/cassandra/compare/1.12.1...1.12.2)) ### Summary More bug fixes. ### Bugfixes * Fixed a problem with the Red Hat family and systemd not starting the service and reporting all service stops as failures, regardless of if they were or not. ##2016-02-08 - Release 1.12.1 ([diff](https://github.com/locp/cassandra/compare/1.12.0...1.12.1)) ### Summary This is a non-functional release. Some bug fixes and release improvements. ### Bugfixes * Completed documentation for attributes. This was missing for the `inter_dc_stream_throughput_outbound_megabits_per_sec` and `stream_throughput_outbound_megabits_per_sec` options. * Corrected the ownership and directories for the OpsCenter configuration. ### Improvements * Nightly build created so that issues similar to those found in issues #136 and #157 can be caught quicker. ##2016-01-27 - Release 1.12.0 ([diff](https://github.com/locp/cassandra/compare/1.11.0...1.12.0)) ### Summary A new feature in the cassandra::datastax_agent class, a minor bug fix and integration with CircleCI. ### Features * There is now an agent_alias attribute for the cassandra::datastax_agent class. ### Bugfixes * Unit tests were failing due to problems with the puppet-3.8.5 gem. ### Improvements * In addition to TravisCI, the build process is now integrated with [CircleCI](https://circleci.com/gh/locp/cassandra). ##2016-01-01 - Release 1.11.0 ([diff](https://github.com/locp/cassandra/compare/1.10.0...1.11.0)) ### Summary New features added to the main class. Also some non-functional improvements. ### Features * The addition of the listen_interface and rpc_interface attributes to the main class. ### Improvements * Added more detail to the attributes to the main class in the README. * Improved the module metadata. * Clarified private defined types with the private subclass. * The test coverage in release 1.10.0 dropped to 99.09%. Got it back to 100% in this release. ##2015-12-19 - Release 1.10.0 ([diff](https://github.com/locp/cassandra/compare/1.9.2...1.10.0)) ### Summary A feature release with minor improvements. ### Features * Added the ability to allow setting the local_interface for the DataStax agent configuration. * Allow the service provider to be specified for the Cassandra, DataStax agent and OpsCenter services with the service_provider attribute. * Optionally allow a systemd system file be inserted with the cassandra::service_systemd attribute. ### Improvements * Allow the files resources specified with in the cassandra attributes: * commitlog_directory * data_file_directories * saved_caches_directory To co-exist with file resources with the same name. ##2015-11-21 - Release 1.9.2 ([diff](https://github.com/locp/cassandra/compare/1.9.1...1.9.2)) ### Summary A bug fix release that deals with some problems with Cassandra 3. ### Bugfixes * Attempt to mitigate against problems with Debian attempting to install Cassandra 3 when installing the dsc22 package. * Also reverted the project home to the GitHub project page. ##2015-11-09 - Release 1.9.1 ([diff](https://github.com/locp/cassandra/compare/1.9.0...1.9.1)) ### Summary A bug fix release. ### Bugfixes * The default value for the permissions mode of the Cassandra configuration file were far too open. Changed from 0666 to 0644. ##2015-10-25 - Release 1.9.0 ([diff](https://github.com/locp/cassandra/compare/1.8.1...1.9.0)) ### Summary Added more features for the configuration of Cassandra, some improvements to the testing carried out before a release and a minor correction to the change log documentation. ### Features * The following attributes have been added to the ::cassandra class to be configured into the configuration file: * client_encryption_algorithm * client_encryption_cipher_suites * client_encryption_protocol * client_encryption_require_client_auth * client_encryption_store_type * client_encryption_truststore * client_encryption_truststore_password * counter_cache_size_in_mb * index_summary_capacity_in_mb * key_cache_save_period * key_cache_keys_to_save * seed_provider_class_name * server_encryption_algorithm * server_encryption_cipher_suites * server_encryption_protocol * server_encryption_require_client_auth * server_encryption_store_type Please see the README file for more details. ### Bugfixes * Corrected an incorrect date (typo) in this document. ### Improvements * There is now an automated test to mitigate the risk of unnecessarily refreshes of the Cassandra service due to non-functional changes to the configuration file. ##2015-10-14 - Release 1.8.1 ([diff](https://github.com/locp/cassandra/compare/1.8.0...1.8.1)) ### Summary A minor bug fix. ### Bugfixes * Fixed an edge case issue concerning users that may have been using the fail_on_non_supported_os before it was fixed in 1.8.0. ##2015-10-06 - Release 1.8.0 ([diff](https://github.com/locp/cassandra/compare/1.7.1...1.8.0)) ### Summary Some new features a minor bug fix and some non-functional improvements. ### Features * Added the service_refresh and config_file_mode attributes to the Cassandra class. ### Bugfixes * The name of the fail_on_non_supported_os attribute has been corrected. ### Improvements * Automated acceptance tests in preparation for a release now run faster. ##1015-10-01 - Release 1.7.1 ([diff](https://github.com/locp/cassandra/compare/1.7.0...1.7.1)) ### Summary A minor bug fix that incorrctly gave a failed build status for the module. ### Bugfixes * Fixed a problem that was showing the status of the module build as an error since the release of the fog-google gem version 0.1.1. ##2015-10-01 - Release 1.7.0 ([diff](https://github.com/locp/cassandra/compare/1.6.0...1.7.0)) ### Summary * Corrected a bug in how commitlog_sync has handled by Cassandra. * Some non-functional improvements * Additional features for the cassandra::datastax_repo class. ### Features * Added the commitlog_segment_size_in_mb attribute to the cassandra class. * Added the following fields to the cassandra::datastax_repo class: * descr * key_id * key_url * pkg_url * release This should make the configuring of repositories more flexible. ### Bugfixes * Fixed a bug in how the commitlog_sync and the attributes that are associated with it are handled ### Improvements The following non-functional improvements were implemented: * Added tags to the module metadata. * Migrated the acceptance tests from Vagrant to Docker. The associated improvements to performance means that more rigorous acceptance tests can be applied in a shorter time. For the first time as well, they are visible on Travis. ##2015-09-23 - Release 1.6.0 ([diff](https://github.com/locp/cassandra/compare/1.5.0...1.6.0)) ### Summary More attributes for ::cassandra and ::cassandra::datastax_agent. Also some non-functional improvements in the automated unit tests. ### Features * The JAVA_HOME can now be set for the datastax_agent (see the cassandra::datastax_agent => java_home attribute). * The file mode for the directories can now be specified for the commitlog_directory, data_file_directories and the saved_caches_directory in the cassandra class. ### Improvements * Uncovered resources in the unit testing are now tested. ##2015-09-21 - Release 1.5.0 ([diff](https://github.com/locp/cassandra/compare/1.4.2...1.5.0)) ### Summary More attributes have been added that can be configured into the cassandra.yaml file. ### Features * The following attributes to the cassandra class can be configured into the cassandra configuration: * broadcast_address * broadcast_rpc_address * commitlog_sync * commitlog_sync_batch_window_in_ms * commitlog_total_space_in_mb * concurrent_compactors * counter_cache_keys_to_save * file_cache_size_in_mb * initial_token * inter_dc_stream_throughput_outbound_megabits_per_sec * internode_authenticator * internode_recv_buff_size_in_bytes * internode_send_buff_size_in_bytes * memory_allocator * memtable_cleanup_threshold * memtable_flush_writers * memtable_heap_space_in_mb * memtable_offheap_space_in_mb * native_transport_max_concurrent_connections * native_transport_max_concurrent_connections_per_ip * native_transport_max_frame_size_in_mb * native_transport_max_threads * permissions_update_interval_in_ms * phi_convict_threshold * request_scheduler_options_default_weight * request_scheduler_options_throttle_limit * row_cache_keys_to_save * rpc_max_threads * rpc_min_threads * rpc_recv_buff_size_in_bytes * rpc_send_buff_size_in_bytes * streaming_socket_timeout_in_ms * stream_throughput_outbound_megabits_per_sec ### Improvements * Clarity of changes per release in the change log (this document). ##2015-09-15 - Release 1.4.2 ([diff](https://github.com/locp/cassandra/compare/1.4.1...1.4.2)) ### Summary Fixed a problem identified whilst releasing 1.4.1 and a bug fixed by a contributed pull request. ### Features * n/a ### Bugfixes * Fixed a problem with the acceptance tests. * The datastax-agent service is restarted if the package is updated. ### Improvements * n/a ##2015-09-15 - Release 1.4.1 ([diff](https://github.com/locp/cassandra/compare/1.4.0...1.4.1)) ### Summary This release fixes a minor bug (possibly better described as a typing mistake) and makes some non-functional improvements. It also allows the user to override the default behaviour of failing on a non-supported operating system. ### Features * A new flag called `fail_on_non_suppoted_os` has been added to the `cassandra` class and can be set to **false** so that an attempt can be made to use this module on an operating system that is not in the Debian or Red Hat families. ### Bugfixes * Changed the default value for the `package_name` of the `cassandra::optutils` class from `'undef'` to *undef*. ### Improvements * Clarified the expectations of submitted contributions. * Unit test improvements. ##2015-09-10 - Release 1.4.0 ([diff](https://github.com/locp/cassandra/compare/1.3.7...1.4.0)) * Ensured that directories specified in the directory attributes are controlled with file resources. * Added the following attributes to the cassandra.yml file: * batchlog_replay_throttle_in_kb * cas_contention_timeout_in_ms * column_index_size_in_kb * commit_failure_policy * compaction_throughput_mb_per_sec * counter_cache_save_period * counter_write_request_timeout_in_ms * cross_node_timeout * dynamic_snitch_badness_threshold * dynamic_snitch_reset_interval_in_ms * dynamic_snitch_update_interval_in_ms * hinted_handoff_throttle_in_kb * index_summary_resize_interval_in_minutes * inter_dc_tcp_nodelay * max_hints_delivery_threads * max_hint_window_in_ms * permissions_validity_in_ms * range_request_timeout_in_ms * read_request_timeout_in_ms * request_scheduler * request_timeout_in_ms * row_cache_save_period * row_cache_size_in_mb * sstable_preemptive_open_interval_in_mb * tombstone_failure_threshold * tombstone_warn_threshold * trickle_fsync * trickle_fsync_interval_in_kb * truncate_request_timeout_in_ms * write_request_timeout_in_ms ##2015-09-08 - Release 1.3.7 ([diff](https://github.com/locp/cassandra/compare/1.3.6...1.3.7)) * Made the auto_bootstrap attribute available. ##2015-09-03 - Release 1.3.6 ([diff](https://github.com/locp/cassandra/compare/1.3.5...1.3.6)) * Fixed a bug, now allowing the user to set the enabled state of the Cassandra service. * More cleaning up of the README and more links in that file to allow faster navigation. - + ##2015-09-01 - Release 1.3.5 ([diff](https://github.com/locp/cassandra/compare/1.3.4...1.3.5)) * Fixed a bug, now allowing the user to set the running state of the Cassandra service. * More automated testing with spec tests. * A refactoring of the README. ##2015-08-28 - Release 1.3.4 ([diff](https://github.com/locp/cassandra/compare/1.3.3...1.3.4)) * Minor corrections to the README. * The addition of the storage_cassandra_seed_hosts attribute to cassandra::opscenter::cluster_name which is part of a bigger part of work but is urgently require by a client. ##2015-08-27 - Release 1.3.3 ([diff](https://github.com/locp/cassandra/compare/1.3.2...1.3.3)) * Corrected dependency version for puppetlabs-apt. ##2015-08-26 - Release 1.3.2 ([diff](https://github.com/locp/cassandra/compare/1.3.1...1.3.2)) * Fixed bug in cassandra::opscenter::cluster_name. * Fixed code in cassandra::firewall_ports::rule to avoid deprecation warnings concerning the use of puppetlabs-firewall => port. * Added more examples to the README ##2015-08-22 - Release 1.3.1 ([diff](https://github.com/locp/cassandra/compare/1.3.0...1.3.1)) This was mainly a non-functional change. The biggest thing to say is that Debian 7 is now supported. ##2015-08-19 - Release 1.3.0 ([diff](https://github.com/locp/cassandra/compare/1.2.0...1.3.0)) * Allow additional TCP ports to be specified for the host based firewall. * Fixed a problem where the client subnets were ignored by the firewall. * Added more automated testing. * Continued work on an ongoing improvement of the documentation. * Added the ability to set the DC and RACK in the snitch properties. ##2015-08-10 - Release 1.2.0 ([diff](https://github.com/locp/cassandra/compare/1.1.0...1.2.0)) * Added the installation of Java Native Access (JNA) to cassandra::java * For DataStax Enterprise, allow the remote storage of metric data with cassandra::opscenter::cluster_name. ##2015-08-03 - Release 1.1.0 ([diff](https://github.com/locp/cassandra/compare/1.0.1...1.1.0)) * Provided the cassandra::firewall_ports class. * All OpsCenter options are now configurable in opscenterd.conf. * ssl_storage_port is now configurable. ##2015-07-27 - Release 1.0.1 ([diff](https://github.com/locp/cassandra/compare/1.0.0...1.0.1)) * Provided a workaround for [CASSANDRA-9822](https://issues.apache.org/jira/browse/CASSANDRA-9822). ##2015-07-25 - Release 1.0.0 ([diff](https://github.com/locp/cassandra/compare/0.4.3...1.0.0)) * Changed the default installation from Cassandra 2.1 to 2.2. * Fixed a bug that arose when the cassandra config_path was set. * Created a workaround for [PUP-3829](https://tickets.puppetlabs.com/browse/PUP-3829). * Minor changes to the API (see the Upgrading section of the README). * Allow a basic installation of OpsCenter. ##2015-07-18 - Release 0.4.3 ([diff](https://github.com/locp/cassandra/compare/0.4.2...0.4.3)) * Module dependency metadata was too strict. ##2015-07-16 - Release 0.4.2 ([diff](https://github.com/locp/cassandra/compare/0.4.1...0.4.2)) * Some minor documentation changes. * Fixed a problem with the module metadata that caused Puppetfile issues. * Integrated with Coveralls (https://coveralls.io/github/locp/cassandra). * Removed the deprecated config and install classes. These were private so there is no change to the API. ##2015-07-14 - Release 0.4.1 ([diff](https://github.com/locp/cassandra/compare/0.4.0...0.4.1)) * Fixed a resource ordering problem in the cassandra::datastax class. * Tidied up the documentation a bit. * Some refactoring of the spec tests. ##2015-07-12 - Release 0.4.0 ([diff](https://github.com/locp/cassandra/compare/0.3.0...0.4.0)) ### Summary * Some major changes to the API on how Java, the optional Cassandra tools and the DataStax agent are installed. See the Upgrading section of the README file. * Allowed the setting of the *stomp_interface* for the DataStax agent. * Non-functionally, we have integrated with Travis CI (see https://travis-ci.org/locp/cassandra for details) and thanks to those guys for providing such a neat service. * More spec tests. ##2015-06-27 - Release 0.3.0 ([diff](https://github.com/locp/cassandra/compare/0.2.2...0.3.0)) ### Summary * Slight changes to the API. See the Upgrading section of the README file for full details. * Allow for the installation of the DataStax Agent. * Improved automated testing (and fixed some bugs along the way). * Confirmed Ubuntu 12.04 works OK with this module. * A Cassandra 1.X template has been provided. * Some smarter handling of the differences between Ubuntu/Debian and RedHat derivatives. ##2015-06-17 - Release 0.2.2 ([diff](https://github.com/locp/cassandra/compare/0.2.1...0.2.2)) ### Summary A non-functional change to change the following: * Split the single manifest into multiple files. * Implement automated testing. * Test on additional operating systems. ##2015-05-28 - Release 0.2.1 ([diff](https://github.com/locp/cassandra/compare/0.2.0...0.2.1)) ### Summary A non-functional change to fix puppet-lint problems identified by Puppet Forge. ##2015-05-28 - Release 0.2.0 ([diff](https://github.com/locp/cassandra/compare/0.1.0...0.2.0)) ### Summary Added more attributes and improved the module metadata. ##2015-05-26 - Release 0.1.0 ### Summary An initial release with **VERY** limited options. diff --git a/circle.yml b/circle.yml deleted file mode 100644 index 8c4da2e..0000000 --- a/circle.yml +++ /dev/null @@ -1,42 +0,0 @@ ---- -branches: - ignore: - - gh-pages # list of branches to ignore -dependencies: - cache_directories: - - "/opt/circleci/.rvm/gems" - override: - - bundle install --without development acceptance: - timeout: 240 - environment: - PUPPET_VERSION: '~> 3.8' - STRICT_VARIABLES: yes - post: - - rvm cleanup all - - bundle clean --force -deployment: - master: - branch: master - commands: - - git config --global user.email "info@locp.co.uk" - - git config --global user.name "CircleCI" - - bundle exec rake strings:gh_pages:update - - bundle exec rake deploy -machine: - environment: - PUPPET_VERSION: '~> 3.8' - STRICT_VARIABLES: yes - ruby: - version: 2.1.9 -notify: - webhooks: - - - url: "https://webhooks.gitter.im/e/da8c065419a91983f0cf" -test: - override: - - bundle exec puppet --version - - bundle exec travis-lint - - bundle exec rake metadata_lint - - bundle exec rake lint - - bundle exec rake validate - - bundle exec rake spec SPEC_OPTS="--format documentation --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/rspec/puppet.xml" diff --git a/metadata.json b/metadata.json index 2173075..394ba29 100644 --- a/metadata.json +++ b/metadata.json @@ -1,82 +1,82 @@ { "name": "locp-cassandra", - "version": "2.4.0", + "version": "2.4.1", "author": "locp", "summary": "Installs Cassandra & DataStax Agent on RHEL/Ubuntu/Debian.", "license": "Apache-2.0", "source": "https://github.com/locp/cassandra", "project_page": "https://github.com/locp/cassandra", "issues_url": "https://github.com/locp/cassandra/issues", "tags": [ "Apache", "cassandra", "cluster", "database", "datastax", "datastax-agent", "nosql" ], "dependencies": [ { "name": "puppetlabs-apt", "version_requirement": ">= 2.0.0 < 3.0.0" }, { "name": "puppetlabs-firewall", "version_requirement": ">= 1.0.0 < 2.0.0" }, { "name": "puppetlabs-inifile", "version_requirement": ">= 1.5.0 < 2.0.0" }, { "name": "puppetlabs-stdlib", "version_requirement": ">= 3.0.0 < 5.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "CentOS", "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ "7", "8" ] }, { "operatingsystem": "Scientific", "operatingsystemrelease": [ "6", "7" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "12.04", "14.04", "16.04" ] } ] } diff --git a/rake/rake_tasks.rb b/rake/rake_tasks.rb index 61a77d2..9c8cddc 100644 --- a/rake/rake_tasks.rb +++ b/rake/rake_tasks.rb @@ -1,48 +1,48 @@ ############################################################################# # Some module specific rake tasks. ############################################################################# require 'fileutils' require_relative 'tasks/deploy' desc '[CI Only] Run beaker, but only for pull requests or for release branches.' task :acceptance do travis_pull_request = ENV['TRAVIS_PULL_REQUEST'] if travis_pull_request.nil? || (travis_pull_request == 'false') puts 'Skipping acceptance tests.' exit(0) else Rake::Task['beaker'].invoke end end desc '[CI Only] Tag, build and push the module to PuppetForge.' task :deploy do abort('Only deploy from master.') unless ENV['CIRCLE_BRANCH'] == 'master' # Find out what the local version of the module is. file = File.read('metadata.json') data_hash = JSON.parse(file) local_version = data_hash['version'] abort('Unable to find local module version.') unless local_version puts "Module version (local): #{local_version}" Rake::Task['deploy:tag'].invoke(local_version) Rake::Task['deploy:forge'].invoke(local_version) end desc 'Run metadata_lint, rubocop, lint, validate and spec.' -task test: %i( +task test: %i[ metadata_lint rubocop lint validate spec -) +] desc 'Clean up after a vagrant run.' task :vagrant_clean do module_root = File.expand_path(File.join(__FILE__, '..', '..')) directory = File.expand_path(File.join(module_root, 'vagrant', 'modules')) FileUtils.rm_r directory if File.directory?(directory) end diff --git a/spec/acceptance/bootstrap_spec.rb b/spec/acceptance/bootstrap_spec.rb index f9d9a73..b887d4a 100644 --- a/spec/acceptance/bootstrap_spec.rb +++ b/spec/acceptance/bootstrap_spec.rb @@ -1,33 +1,13 @@ require 'spec_helper_acceptance' -describe 'Bootstrap' do - bootstrap_pp = <<-EOS - case downcase($::operatingsystem) { - 'centos': { - if $::operatingsystemmajrelease == 6 { - exec { '/bin/cp /opt/rh/ruby200/enable /etc/profile.d/ruby.sh': } -> - exec { '/bin/rm /usr/bin/ruby /usr/bin/gem': } -> - exec { '/usr/sbin/alternatives --install /usr/bin/ruby ruby /opt/rh/ruby200/root/usr/bin/ruby 1000': } -> - exec { '/usr/sbin/alternatives --install /usr/bin/gem gem /opt/rh/ruby200/root/usr/bin/gem 1000': } - } - } - 'ubuntu': { - if $::operatingsystemmajrelease == 12.04 { - package {'python-software-properties':} -> - exec {'/usr/bin/apt-add-repository ppa:brightbox/ruby-ng':} -> - exec {'/usr/bin/apt-get update': } -> - package {'ruby2.0': } -> - exec { '/bin/rm /usr/bin/ruby': } -> - exec { '/usr/sbin/update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0 1000': } - } - } - } - EOS +osfamily = fact('osfamily') +roles = hosts[0]['roles'] +t = TestManifests.new(roles, 0) +bootstrap_pp = t.bootstrap_pp() - describe '########### Node specific manifest.' do - it 'should work with no errors' do - apply_manifest(bootstrap_pp, catch_failures: true) - shell('[ -d /opt/rh/ruby200 ] && /usr/bin/gem install puppet -v 3.8.7 --no-rdoc --no-ri; true') - end +describe 'Test Entry Criteria' do + it "Should work with no errors (#{osfamily})" do + apply_manifest(bootstrap_pp, catch_failures: true) + shell('[ -d /opt/rh/ruby200 ] && /usr/bin/gem install puppet -v 3.8.7 --no-rdoc --no-ri; true') end end diff --git a/spec/acceptance/cassandra2_spec.rb b/spec/acceptance/cassandra2_spec.rb deleted file mode 100644 index 99ac7e8..0000000 --- a/spec/acceptance/cassandra2_spec.rb +++ /dev/null @@ -1,423 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'cassandra2', unless: CASSANDRA2_UNSUPPORTED_PLATFORMS.include?(fact('lsbdistrelease')) do - cassandra_install_pp = <<-EOS - include cassandra::datastax_repo - include cassandra::java - # require cassandra::system::sysctl - require cassandra::system::swapoff - require cassandra::system::transparent_hugepage - - $version = '2.2.8' - - if $::osfamily == 'RedHat' { - $package_ensure = "${version}-1" - $cassandra_optutils_package = 'cassandra22-tools' - $cassandra_package = 'cassandra22' - } else { - $package_ensure = $version - $cassandra_optutils_package = 'cassandra-tools' - $cassandra_package = 'cassandra' - - exec { '/bin/chown root:root /etc/apt/sources.list.d/datastax.list': - unless => '/usr/bin/test -O /etc/apt/sources.list.d/datastax.list', - require => Class['cassandra::datastax_agent'] - } - } - - class { 'cassandra': - package_ensure => $package_ensure, - package_name => $cassandra_package, - require => Class['cassandra::datastax_repo', 'cassandra::java'] - } - - class { 'cassandra::optutils': - package_ensure => $package_ensure, - package_name => $cassandra_optutils_package, - require => Class['cassandra'] - } - - class { 'cassandra::datastax_agent': - require => Class['cassandra'] - } - - # This really sucks but Docker, CentOS 6 and iptables don't play nicely - # together. Therefore we can't test the firewall on this platform :-( - if $::operatingsystem != CentOS and $::operatingsystemmajrelease != 6 { - include '::cassandra::firewall_ports' - } - EOS - - describe '########### Cassandra installation.' do - it 'should work with no errors' do - apply_manifest(cassandra_install_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(cassandra_install_pp, - catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_create_pp = <<-EOS - #{cassandra_install_pp} - - $cql_types = { - 'fullname' => { - 'keyspace' => 'mykeyspace', - 'fields' => { - 'fname' => 'text', - 'lname' => 'text', - }, - }, - } - - $keyspaces = { - 'mykeyspace' => { - ensure => present, - replication_map => { - keyspace_class => 'SimpleStrategy', - replication_factor => 1, - }, - durable_writes => false, - }, - } - - class { 'cassandra::schema': - cql_types => $cql_types, - cqlsh_password => 'cassandra', - cqlsh_user => 'cassandra', - indexes => { - 'users_lname_idx' => { - keyspace => 'mykeyspace', - table => 'users', - keys => 'lname', - }, - }, - keyspaces => $keyspaces, - tables => { - 'users' => { - 'keyspace' => 'mykeyspace', - 'columns' => { - 'userid' => 'int', - 'fname' => 'text', - 'lname' => 'text', - 'PRIMARY KEY' => '(userid)', - }, - }, - }, - permissions => { - 'Grant select permissions to spillman to all keyspaces' => { - permission_name => 'SELECT', - user_name => 'spillman', - }, - 'Grant modify to to keyspace mykeyspace to akers' => { - keyspace_name => 'mykeyspace', - permission_name => 'MODIFY', - user_name => 'akers', - }, - 'Grant alter permissions to mykeyspace to boone' => { - keyspace_name => 'mykeyspace', - permission_name => 'ALTER', - user_name => 'boone', - }, - 'Grant ALL permissions to mykeyspace.users to gbennet' => { - keyspace_name => 'mykeyspace', - permission_name => 'ALTER', - table_name => 'users', - user_name => 'gbennet', - }, - }, - users => { - 'akers' => { - password => 'Niner2', - superuser => true, - }, - 'boone' => { - password => 'Niner75', - }, - 'gbennet' => { - password => 'Strewth', - }, - 'spillman' => { - password => 'Niner27', - }, - }, - } - EOS - - describe '########### Schema create.' do - it 'should work with no errors' do - apply_manifest(schema_testing_create_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_create_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_drop_type_pp = <<-EOS - #{cassandra_install_pp} - - $cql_types = { - 'fullname' => { - 'keyspace' => 'mykeyspace', - 'ensure' => 'absent' - } - } - - class { 'cassandra::schema': - cql_types => $cql_types, - cqlsh_user => 'akers', - cqlsh_password => 'Niner2', - } - EOS - - describe '########### Schema drop type.' do - it 'should work with no errors' do - apply_manifest(schema_drop_type_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_drop_type_pp, catch_failures: true).exit_code).to be_zero - end - end - - permissions_revoke_pp = <<-EOS - #{cassandra_install_pp} - - class { 'cassandra::schema': - cqlsh_password => 'Niner2', - cqlsh_user => 'akers', - cqlsh_client_config => '/root/.puppetcqlshrc', - permissions => { - 'Revoke select permissions to spillman to all keyspaces' => { - ensure => absent, - permission_name => 'SELECT', - user_name => 'spillman', - }, - 'Revoke modify to to keyspace mykeyspace to akers' => { - ensure => absent, - keyspace_name => 'mykeyspace', - permission_name => 'MODIFY', - user_name => 'akers', - }, - 'Revoke alter permissions to mykeyspace to boone' => { - ensure => absent, - keyspace_name => 'mykeyspace', - permission_name => 'ALTER', - user_name => 'boone', - }, - 'Revoke ALL permissions to mykeyspace.users to gbennet' => { - ensure => absent, - keyspace_name => 'mykeyspace', - permission_name => 'ALTER', - table_name => 'users', - user_name => 'gbennet', - }, - }, - } - EOS - - describe '########### Revoke permissions.' do - it 'should work with no errors' do - apply_manifest(permissions_revoke_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(permissions_revoke_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_drop_user_pp = <<-EOS - #{cassandra_install_pp} - - class { 'cassandra::schema': - cqlsh_password => 'Niner2', - cqlsh_user => 'akers', - cqlsh_client_config => '/root/.puppetcqlshrc', - users => { - 'boone' => { - ensure => absent, - }, - }, - } - EOS - - describe '########### Drop the boone user.' do - it 'should work with no errors' do - apply_manifest(schema_drop_user_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_drop_user_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_drop_index_pp = <<-EOS - #{cassandra_install_pp} - - class { 'cassandra::schema': - cqlsh_user => 'akers', - cqlsh_password => 'Niner2', - indexes => { - 'users_lname_idx' => { - ensure => absent, - keyspace => 'mykeyspace', - table => 'users', - }, - }, - } - EOS - - describe '########### Schema drop index.' do - it 'should work with no errors' do - apply_manifest(schema_testing_drop_index_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_drop_index_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_drop_pp = <<-EOS - #{cassandra_install_pp} - - class { 'cassandra::schema': - cqlsh_password => 'Niner2', - cqlsh_user => 'akers', - tables => { - 'users' => { - ensure => absent, - keyspace => 'mykeyspace', - }, - }, - } - EOS - - describe '########### Schema drop (table).' do - it 'should work with no errors' do - apply_manifest(schema_testing_drop_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_drop_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_drop_pp = <<-EOS - #{cassandra_install_pp} - - $keyspaces = { - 'mykeyspace' => { - ensure => absent, - } - } - - class { 'cassandra::schema': - cqlsh_password => 'Niner2', - cqlsh_user => 'akers', - keyspaces => $keyspaces, - } - EOS - - describe '########### Schema drop (Keyspaces).' do - it 'should work with no errors' do - apply_manifest(schema_testing_drop_pp, catch_failures: true) - end - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_drop_pp, catch_failures: true).exit_code).to be_zero - end - end - - describe service('cassandra') do - it do - is_expected.to be_running - is_expected.to be_enabled - end - end - - describe service('datastax-agent') do - it do - is_expected.to be_running - is_expected.to be_enabled - end - end - - facts_testing_pp = <<-EOS - #{cassandra_install_pp} - - if $::cassandrarelease != $version { - fail("Test1: ${version} != ${::cassandrarelease}") - } - - $assembled_version = "${::cassandramajorversion}.${::cassandraminorversion}.${::cassandrapatchversion}" - - if $version != $assembled_version { - fail("Test2: ${version} != ${::assembled_version}") - } - - if $::cassandramaxheapsize <= 0 { - fail('cassandramaxheapsize is not set.') - } - if $::cassandracmsmaxheapsize <= 0 { - fail('cassandracmsmaxheapsize is not set.') - } - if $::cassandraheapnewsize <= 0 { - fail('cassandraheapnewsize is not set.') - } - if $::cassandracmsheapnewsize <= 0 { - fail('cassandracmsheapnewsize is not set.') - } - EOS - - describe '########### Facts Tests.' do - it 'should work with no errors' do - apply_manifest(facts_testing_pp, catch_failures: true) - end - end - - describe '########### Gather service information (when in debug mode).' do - it 'Show the cassandra system log.' do - shell("grep -v -e '^INFO' -e '^\s*INFO' /var/log/cassandra/system.log") - end - end - - cassandra_uninstall_pp = <<-EOS - Exec { - path => [ - '/usr/local/bin', - '/opt/local/bin', - '/usr/bin', - '/usr/sbin', - '/bin', - '/sbin'], - logoutput => true, - } - - if $::osfamily == 'RedHat' { - $cassandra_optutils_package = 'cassandra22-tools' - $cassandra_package = 'cassandra22' - } else { - $cassandra_optutils_package = 'cassandra-tools' - $cassandra_package = 'cassandra' - } - - service { 'cassandra': - ensure => stopped, - } -> - package { $cassandra_optutils_package: - ensure => purged, - } -> - package { $cassandra_package: - ensure => purged, - } -> - exec { 'rm -rf /var/lib/cassandra/*/* /var/log/cassandra/*': } - EOS - - describe '########### Uninstall Cassandra 2.' do - it 'should work with no errors' do - apply_manifest(cassandra_uninstall_pp, catch_failures: true) - end - end -end diff --git a/spec/acceptance/cassandra3_spec.rb b/spec/acceptance/cassandra3_spec.rb deleted file mode 100644 index a9e16a6..0000000 --- a/spec/acceptance/cassandra3_spec.rb +++ /dev/null @@ -1,318 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'cassandra3' do - version = '3.0.9' - - cassandra_install_pp = <<-EOS - include cassandra::datastax_repo - include cassandra::java - - $version = '#{version}' - - if $::osfamily == 'RedHat' { - $package_ensure = "${version}-1" - $cassandra_optutils_package = 'cassandra30-tools' - $cassandra_package = 'cassandra30' - } else { - $cassandra_optutils_package = 'cassandra-tools' - $cassandra_package = 'cassandra' - $package_ensure = $version - - if $::lsbdistid == 'Ubuntu' { - if $::operatingsystemmajrelease >= 16 { - # Workarounds for amonst other things CASSANDRA-11850 - Exec { - environment => [ 'CQLSH_NO_BUNDLED=TRUE' ] - } - } - } - - exec { '/bin/chown root:root /etc/apt/sources.list.d/datastax.list': - unless => '/usr/bin/test -O /etc/apt/sources.list.d/datastax.list', - require => Class['cassandra::datastax_agent'] - } - } - - if versioncmp($::rubyversion, '1.9.0') < 0 { - $service_refresh = false - } else { - $service_refresh = true - } - - class { 'cassandra': - hints_directory => '/var/lib/cassandra/hints', - package_ensure => $package_ensure, - package_name => $cassandra_package, - service_refresh => $service_refresh, - require => Class['cassandra::datastax_repo', 'cassandra::java'] - } - - class { 'cassandra::optutils': - package_ensure => $package_ensure, - package_name => $cassandra_optutils_package, - require => Class['cassandra'] - } - - class { 'cassandra::datastax_agent': - require => Class['cassandra'] - } - - # This really sucks but Docker, CentOS 6 and iptables don't play nicely - # together. Therefore we can't test the firewall on this platform :-( - if $::operatingsystem != CentOS and $::operatingsystemmajrelease != 6 { - include '::cassandra::firewall_ports' - } - EOS - - describe "########### Cassandra #{version} installation" do - it 'should work with no errors' do - apply_manifest(cassandra_install_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(cassandra_install_pp, - catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_create_pp = <<-EOS - #{cassandra_install_pp} - - $cql_types = { - 'fullname' => { - 'keyspace' => 'mykeyspace', - 'fields' => { - 'fname' => 'text', - 'lname' => 'text', - }, - }, - } - - $keyspaces = { - 'mykeyspace' => { - ensure => present, - replication_map => { - keyspace_class => 'SimpleStrategy', - replication_factor => 1, - }, - durable_writes => false, - }, - } - - class { 'cassandra::schema': - cql_types => $cql_types, - cqlsh_password => 'cassandra', - cqlsh_user => 'cassandra', - indexes => { - 'users_lname_idx' => { - keyspace => 'mykeyspace', - table => 'users', - keys => 'lname', - }, - }, - keyspaces => $keyspaces, - tables => { - 'users' => { - 'keyspace' => 'mykeyspace', - 'columns' => { - 'userid' => 'int', - 'fname' => 'text', - 'lname' => 'text', - 'PRIMARY KEY' => '(userid)', - }, - }, - }, - users => { - 'spillman' => { - password => 'Niner27', - }, - 'akers' => { - password => 'Niner2', - superuser => true, - }, - 'boone' => { - password => 'Niner75', - }, - }, - } - EOS - - describe "########### Schema create #{version}" do - it 'should work with no errors' do - apply_manifest(schema_testing_create_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_create_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_drop_type_pp = <<-EOS - #{cassandra_install_pp} - - $cql_types = { - 'fullname' => { - 'keyspace' => 'mykeyspace', - 'ensure' => 'absent' - } - } - - class { 'cassandra::schema': - cql_types => $cql_types, - cqlsh_user => 'akers', - cqlsh_password => 'Niner2', - } - EOS - - describe "########### Schema drop type #{version}" do - it 'should work with no errors' do - apply_manifest(schema_testing_drop_type_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_drop_type_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_drop_user_pp = <<-EOS - #{cassandra_install_pp} - - class { 'cassandra::schema': - cqlsh_password => 'Niner2', - cqlsh_user => 'akers', - cqlsh_client_config => '/root/.puppetcqlshrc', - users => { - 'boone' => { - ensure => absent, - }, - }, - } - EOS - - describe "########### Drop the boone user #{version}" do - it 'should work with no errors' do - apply_manifest(schema_testing_drop_user_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_drop_user_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_drop_index_pp = <<-EOS - #{cassandra_install_pp} - - class { 'cassandra::schema': - cqlsh_user => 'akers', - cqlsh_password => 'Niner2', - indexes => { - 'users_lname_idx' => { - ensure => absent, - keyspace => 'mykeyspace', - table => 'users', - }, - }, - } - EOS - - describe "########### Schema drop index #{version}" do - it 'should work with no errors' do - apply_manifest(schema_testing_drop_index_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_drop_index_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_drop_pp = <<-EOS - #{cassandra_install_pp} - - class { 'cassandra::schema': - cqlsh_password => 'Niner2', - cqlsh_user => 'akers', - tables => { - 'users' => { - ensure => absent, - keyspace => 'mykeyspace', - }, - }, - } - EOS - - describe "########### Schema drop (table) #{version}" do - it 'should work with no errors' do - apply_manifest(schema_testing_drop_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_drop_pp, catch_failures: true).exit_code).to be_zero - end - end - - schema_testing_drop_pp = <<-EOS - #{cassandra_install_pp} - - $keyspaces = { - 'mykeyspace' => { - ensure => absent, - } - } - - class { 'cassandra::schema': - cqlsh_password => 'Niner2', - cqlsh_user => 'akers', - keyspaces => $keyspaces, - } - EOS - - describe "########### Schema drop (Keyspaces) #{version}" do - it 'should work with no errors' do - apply_manifest(schema_testing_drop_pp, catch_failures: true) - end - - it 'check code is idempotent' do - expect(apply_manifest(schema_testing_drop_pp, catch_failures: true).exit_code).to be_zero - end - end - - describe service('cassandra') do - it do - is_expected.to be_running - is_expected.to be_enabled - end - end - - describe service('datastax-agent') do - it do - is_expected.to be_running - is_expected.to be_enabled - end - end - - facts_testing_pp = <<-EOS - #{cassandra_install_pp} - - if $::cassandrarelease != $version { - fail("Test1: ${version} != ${::cassandrarelease}") - } - - $assembled_version = "${::cassandramajorversion}.${::cassandraminorversion}.${::cassandrapatchversion}" - - if $version != $assembled_version { - fail("Test2: ${version} != ${::assembled_version}") - } - EOS - - describe "########### Facts Tests #{version}" do - it 'should work with no errors' do - apply_manifest(facts_testing_pp, catch_failures: true) - end - end - - describe '########### Gather service information (when in debug mode).' do - it 'Show the cassandra system log.' do - shell("grep -v -e '^INFO' -e '^\s*INFO' /var/log/cassandra/system.log") - end - end -end diff --git a/spec/acceptance/cassandra_spec.rb b/spec/acceptance/cassandra_spec.rb new file mode 100644 index 0000000..7cff55f --- /dev/null +++ b/spec/acceptance/cassandra_spec.rb @@ -0,0 +1,128 @@ +require 'spec_helper_acceptance' + +describe 'cassandra' do + roles = hosts[0]['roles'] + versions = [] + versions.push(2.1) if roles.include? 'cassandra2' + versions.push(2.2) if roles.include? 'cassandra2' + versions.push(3.0) if roles.include? 'cassandra3' + + versions.each do |version| + t = TestManifests.new(roles, version) + + describe "Cassandra #{version} installation." do + # firewall_pp = t.firewall_pp() + cassandra_install_pp = t.cassandra_install_pp + + it 'should work with no errors' do + apply_manifest(cassandra_install_pp, catch_failures: true) + end + + it 'check code is idempotent' do + expect(apply_manifest(cassandra_install_pp, + catch_failures: true).exit_code).to be_zero + end + end + + describe service('cassandra') do + it "check Cassandra-#{version} is running and enabled" do + is_expected.to be_running + is_expected.to be_enabled + end + end + + if fact('osfamily') == 'RedHat' + describe service('datastax-agent') do + it 'check service status' do + is_expected.to be_running + is_expected.to be_enabled + end + end + end + + describe "Create schema for #{version}." do + it 'should work with no errors' do + apply_manifest(t.schema_create_pp, catch_failures: true) + end + + if version != 2.1 + it 'check code is idempotent' do + expect(apply_manifest(t.schema_create_pp, catch_failures: true).exit_code).to be_zero + end + end + end + + describe "Schema drop type for #{version}." do + it 'should work with no errors' do + apply_manifest(t.schema_drop_type_pp, catch_failures: true) + end + + it 'check code is idempotent' do + expect(apply_manifest(t.schema_drop_type_pp, catch_failures: true).exit_code).to be_zero + end + end + + describe "Revoke permissions for #{version}." do + it 'should work with no errors' do + apply_manifest(t.permissions_revoke_pp, catch_failures: true) + end + + it 'check code is idempotent' do + expect(apply_manifest(t.permissions_revoke_pp, catch_failures: true).exit_code).to be_zero + end + end + + describe "Drop user for #{version}" do + it 'should work with no errors' do + apply_manifest(t.schema_drop_user_pp, catch_failures: true) + end + + it 'check code is idempotent' do + expect(apply_manifest(t.schema_drop_user_pp, catch_failures: true).exit_code).to be_zero + end + end + + describe "Drop index for #{version}" do + it 'should work with no errors' do + apply_manifest(t.schema_drop_index_pp, catch_failures: true) + end + + it 'check code is idempotent' do + expect(apply_manifest(t.schema_drop_index_pp, catch_failures: true).exit_code).to be_zero + end + end + + describe "Drop table for #{version}" do + it 'should work with no errors' do + apply_manifest(t.schema_drop_table_pp, catch_failures: true) + end + + it 'check code is idempotent' do + expect(apply_manifest(t.schema_drop_table_pp, catch_failures: true).exit_code).to be_zero + end + end + + describe "Drop keyspace for #{version}" do + it 'should work with no errors' do + apply_manifest(t.schema_drop_keyspace_pp, catch_failures: true) + end + + it 'check code is idempotent' do + expect(apply_manifest(t.schema_drop_keyspace_pp, catch_failures: true).exit_code).to be_zero + end + end + + describe "Facts Tests for #{version}" do + it 'should work with no errors' do + apply_manifest(t.facts_testing_pp, catch_failures: true) + end + end + + next unless version != 3.0 + describe "Uninstall #{version}." do + it 'should work with no errors' do + apply_manifest(t.cassandra_uninstall_pp, catch_failures: true) + end + end + end +end diff --git a/spec/acceptance/hieradata/common.yaml b/spec/acceptance/hieradata/common.yaml deleted file mode 100644 index 5e8dccd..0000000 --- a/spec/acceptance/hieradata/common.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -############################################################################# -# common.yaml -# =========== -# -# A file for hiera data that is relevant to all test nodes. -############################################################################# - -cassandra::cassandra_9822: true -cassandra::dc: 'LON' -cassandra::rack: 'R101' -cassandra::service_ensure: running diff --git a/spec/acceptance/hieradata/environments/production/data/common.yaml b/spec/acceptance/hieradata/environments/production/data/common.yaml index f94b99b..627d14b 100644 --- a/spec/acceptance/hieradata/environments/production/data/common.yaml +++ b/spec/acceptance/hieradata/environments/production/data/common.yaml @@ -1,93 +1,122 @@ --- ############################################################################# # common.yaml # =========== # # A file for hiera data that is relevant to all test nodes. ############################################################################# cassandra::baseline_settings: authenticator: AllowAllAuthenticator authorizer: AllowAllAuthorizer auto_snapshot: true batch_size_warn_threshold_in_kb: 5 batchlog_replay_throttle_in_kb: 1024 cas_contention_timeout_in_ms: 1000 - client_encryption_options: + client_encryption_options: enabled: false keystore: conf/.keystore keystore_password: cassandra cluster_name: "Test Cluster" column_index_size_in_kb: 64 commit_failure_policy: stop commitlog_directory: /var/lib/cassandra/commitlog commitlog_segment_size_in_mb: 32 commitlog_sync: periodic commitlog_sync_period_in_ms: 10000 compaction_throughput_mb_per_sec: 16 concurrent_counter_writes: 32 concurrent_reads: 32 concurrent_writes: 32 counter_cache_save_period: 7200 counter_write_request_timeout_in_ms: 5000 cross_node_timeout: false - data_file_directories: + data_file_directories: - /var/lib/cassandra/data disk_failure_policy: stop dynamic_snitch_badness_threshold: 0.1 dynamic_snitch_reset_interval_in_ms: 600000 dynamic_snitch_update_interval_in_ms: 100 endpoint_snitch: SimpleSnitch hinted_handoff_enabled: true hinted_handoff_throttle_in_kb: 1024 incremental_backups: false index_summary_resize_interval_in_minutes: 60 inter_dc_tcp_nodelay: false internode_compression: all key_cache_save_period: 14400 listen_address: localhost max_hint_window_in_ms: 10800000 max_hints_delivery_threads: 2 memtable_allocation_type: heap_buffers native_transport_port: 9042 num_tokens: 256 partitioner: org.apache.cassandra.dht.Murmur3Partitioner permissions_validity_in_ms: 2000 range_request_timeout_in_ms: 10000 read_request_timeout_in_ms: 5000 request_scheduler: org.apache.cassandra.scheduler.NoScheduler request_timeout_in_ms: 10000 row_cache_save_period: 0 row_cache_size_in_mb: 0 rpc_address: localhost rpc_keepalive: true rpc_port: 9160 rpc_server_type: sync saved_caches_directory: /var/lib/cassandra/saved_caches - seed_provider: + seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider - parameters: + parameters: - seeds: "127.0.0.1" - server_encryption_options: + server_encryption_options: internode_encryption: none keystore: conf/.keystore keystore_password: cassandra truststore: conf/.truststore truststore_password: cassandra snapshot_before_compaction: false ssl_storage_port: 7001 sstable_preemptive_open_interval_in_mb: 50 start_native_transport: true start_rpc: true storage_port: 7000 thrift_framed_transport_size_in_mb: 15 tombstone_failure_threshold: 100000 tombstone_warn_threshold: 1000 trickle_fsync: false trickle_fsync_interval_in_kb: 10240 truncate_request_timeout_in_ms: 60000 write_request_timeout_in_ms: 2000 cassandra::cassandra_9822: true cassandra::dc: LON + +cassandra::dse: + file_lines: + 'Set HADOOP_LOG_DIR directory': + ensure: present + path: '/etc/dse/dse-env.sh' + line: 'export HADOOP_LOG_DIR=/var/log/hadoop' + match: '^# export HADOOP_LOG_DIR=' + 'Set DSE_HOME': + ensure: present + path: '/etc/dse/dse-env.sh' + line: 'export DSE_HOME=/usr/share/dse' + match: '^#export DSE_HOME' + settings: + ldap_options: + server_host: localhost + server_port: 389 + search_dn: 'cn=Admin' + search_password: 'secret' + use_ssl: false + use_tls: false + truststore_type: jks + user_search_base: 'ou=users,dc=example,dc=com' + user_search_filter: '(uid={0})' + credentials_validity_in_ms: 0 + connection_pool: + max_active: 8 + max_idle: 8 + cassandra::rack: R101 cassandra::service_ensure: running diff --git a/spec/acceptance/hieradata/operatingsystem/CentOS-6.yaml b/spec/acceptance/hieradata/operatingsystem/CentOS-6.yaml deleted file mode 100644 index 037d2a3..0000000 --- a/spec/acceptance/hieradata/operatingsystem/CentOS-6.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -cassandra::run_schema_tests: false -cassandra::system::swapoff::device: '/dev/mapper/VolGroup-lv_swap' -cassandra::system::sysctl::sysctl_file: '/etc/sysctl.conf' -cassandra::system::sysctl::net_ipv4_tcp_rmem: '4096 87380 16777216' -cassandra::system::sysctl::net_ipv4_tcp_wmem: '4096 65536 16777216' -cassandra::system::sysctl::sysctl_args: '-e -p' diff --git a/spec/acceptance/hieradata/operatingsystem/CentOS-7.yaml b/spec/acceptance/hieradata/operatingsystem/CentOS-7.yaml deleted file mode 100644 index 6ddcd8d..0000000 --- a/spec/acceptance/hieradata/operatingsystem/CentOS-7.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -cassandra::system::swapoff::device: '/dev/mapper/centos-swap' -cassandra::system::sysctl::net_ipv4_tcp_rmem: '4096, 87380, 16777216' -cassandra::system::sysctl::net_ipv4_tcp_wmem: '4096, 65536, 16777216' -cassandra::system::sysctl::sysctl_file: '/etc/sysctl.d/10-cassandra.conf' diff --git a/spec/acceptance/hieradata/operatingsystem/Debian.yaml b/spec/acceptance/hieradata/operatingsystem/Debian.yaml deleted file mode 100644 index 49706f4..0000000 --- a/spec/acceptance/hieradata/operatingsystem/Debian.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -cassandra::java::aptkey: - ZuluJDK: - id: '27BC0C8CB3D81623F59BDADCB1998361219BD9C9' - server: 'keyserver.ubuntu.com' - -cassandra::java::aptsource: - ZuluJDK: - location: 'http://repos.azulsystems.com/debian' - comment: 'Zulu OpenJDK 8 for Debian' - release: 'stable' - repos: 'main' - -cassandra::java::package_name: 'zulu-8' diff --git a/spec/acceptance/hieradata/operatingsystem/Ubuntu-12.04.yaml b/spec/acceptance/hieradata/operatingsystem/Ubuntu-12.04.yaml deleted file mode 100644 index 7f408ec..0000000 --- a/spec/acceptance/hieradata/operatingsystem/Ubuntu-12.04.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -cassandra::java::aptsource: - OpenJDK: - comment: 'OpenJDK builds (all archs)' - location: 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu' - release: 'precise' - -cassandra::system::sysctl::net_ipv4_tcp_rmem: '4096 87380 16777216' -cassandra::system::sysctl::net_ipv4_tcp_wmem: '4096 65536 16777216' diff --git a/spec/acceptance/hieradata/operatingsystem/Ubuntu-14.04.yaml b/spec/acceptance/hieradata/operatingsystem/Ubuntu-14.04.yaml deleted file mode 100644 index ea8e288..0000000 --- a/spec/acceptance/hieradata/operatingsystem/Ubuntu-14.04.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -cassandra::java::aptsource: - OpenJDK: - comment: 'OpenJDK builds (all archs)' - location: 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu' - release: 'trusty' diff --git a/spec/acceptance/hieradata/operatingsystem/Ubuntu-16.04.yaml b/spec/acceptance/hieradata/operatingsystem/Ubuntu-16.04.yaml deleted file mode 100644 index fe91128..0000000 --- a/spec/acceptance/hieradata/operatingsystem/Ubuntu-16.04.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -cassandra::java::aptsource: - OpenJDK: - comment: 'OpenJDK builds (all archs)' - location: 'http://ppa.launchpad.net/openjdk-r/ppa/ubuntu' - release: 'xenial' diff --git a/spec/acceptance/hieradata/operatingsystem/Ubuntu.yaml b/spec/acceptance/hieradata/operatingsystem/Ubuntu.yaml deleted file mode 100644 index 912be1c..0000000 --- a/spec/acceptance/hieradata/operatingsystem/Ubuntu.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -cassandra::java::aptkey: - OpenJDK: - id: 'DA1A4A13543B466853BAF164EB9B1D8886F44E2A' - server: 'keyserver.ubuntu.com' - -cassandra::java::package_name: 'openjdk-8-jdk' diff --git a/spec/acceptance/nodesets/centos6.yml b/spec/acceptance/nodesets/centos6.yml deleted file mode 100644 index adcd3cb..0000000 --- a/spec/acceptance/nodesets/centos6.yml +++ /dev/null @@ -1,19 +0,0 @@ -HOSTS: - centos6: - roles: - - centos6 - - nodes - platform: el-6-x86_64 - image: centos:6 - hypervisor: docker - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'yum -y install gcc tar yum-utils centos-release-scl' - - 'yum-config-manager --enable rhel-server-rhscl-7-rpms' - - 'yum -y install ruby200 python27' - - 'cp /opt/rh/python27/enable /etc/profile.d/python.sh' - - 'echo "" >> /etc/profile.d/python.sh' - - 'echo "export PYTHONPATH=/usr/lib/python2.7/site-packages" >> /etc/profile.d/python.sh' -CONFIG: - type: foss - log_level: notice diff --git a/spec/acceptance/nodesets/centos6_2.yml b/spec/acceptance/nodesets/centos6_2.yml new file mode 100644 index 0000000..1b698ef --- /dev/null +++ b/spec/acceptance/nodesets/centos6_2.yml @@ -0,0 +1,12 @@ +--- +CONFIG: + log_level: notice + type: foss +HOSTS: + centos6: + docker_cmd: "[\"/sbin/init\"]" + hypervisor: docker + image: "centos:6" + platform: el-6-x86_64 + roles: + - cassandra2 diff --git a/spec/acceptance/nodesets/centos6_3.yml b/spec/acceptance/nodesets/centos6_3.yml new file mode 100644 index 0000000..a418a3f --- /dev/null +++ b/spec/acceptance/nodesets/centos6_3.yml @@ -0,0 +1,12 @@ +--- +CONFIG: + log_level: notice + type: foss +HOSTS: + centos6: + docker_cmd: "[\"/sbin/init\"]" + hypervisor: docker + image: "centos:6" + platform: el-6-x86_64 + roles: + - cassandra3 diff --git a/spec/acceptance/nodesets/centos7.yml b/spec/acceptance/nodesets/centos7.yml index edb28e2..4812de2 100644 --- a/spec/acceptance/nodesets/centos7.yml +++ b/spec/acceptance/nodesets/centos7.yml @@ -1,15 +1,15 @@ +--- +CONFIG: + log_level: notice + type: foss HOSTS: centos7: - roles: - - master - - centos7 - - nodes - platform: el-7-x86_64 - image: centos:7 - hypervisor: docker - docker_cmd: '["/sbin/init"]' + docker_cmd: "[\"/sbin/init\"]" docker_image_commands: - - 'yum -y install gcc tar systemd-container initscripts' -CONFIG: - type: foss - log_level: notice + - "yum -y install gcc tar systemd-container initscripts" + hypervisor: docker + image: "centos:7" + platform: el-7-x86_64 + roles: + - cassandra2 + - cassandra3 diff --git a/spec/acceptance/nodesets/debian7.yml b/spec/acceptance/nodesets/debian7.yml index 7cb7345..a832f44 100644 --- a/spec/acceptance/nodesets/debian7.yml +++ b/spec/acceptance/nodesets/debian7.yml @@ -1,13 +1,15 @@ ---- -CONFIG: +--- +CONFIG: log_level: notice type: foss -HOSTS: - debian7: - docker_image_commands: - - "apt-get install -y sudo ufw wget" +HOSTS: + debian7: + docker_image_commands: + - "apt-get install -y wget" hypervisor: docker image: "debian:7" platform: debian-7-amd64 - roles: - - debian7 + roles: + - cassandra2 + - cassandra3 + - firewall diff --git a/spec/acceptance/nodesets/debian8.yml b/spec/acceptance/nodesets/debian8.yml index 1573bd3..1bc3974 100644 --- a/spec/acceptance/nodesets/debian8.yml +++ b/spec/acceptance/nodesets/debian8.yml @@ -1,19 +1,18 @@ --- +CONFIG: + log_level: notice + type: foss HOSTS: debian8: - roles: - - master - - debian8 default_apply_opts: order: random - strict_variables: - platform: debian-8-amd64 - image: debian:8 - hypervisor: docker + strict_variables: ~ + docker_cmd: "[\"/sbin/init\"]" docker_image_commands: - - 'apt-get install -y locales-all net-tools sudo ufw wget' - - 'rm -f /usr/sbin/policy-rc.d' - docker_cmd: '["/sbin/init"]' -CONFIG: - type: foss - log_level: notice + - "apt-get install -y wget" + hypervisor: docker + image: "debian:8" + platform: debian-8-amd64 + roles: + - cassandra2 + - cassandra3 diff --git a/spec/acceptance/nodesets/ubuntu1204.yml b/spec/acceptance/nodesets/ubuntu1204.yml index e56baea..00ad3f0 100644 --- a/spec/acceptance/nodesets/ubuntu1204.yml +++ b/spec/acceptance/nodesets/ubuntu1204.yml @@ -1,14 +1,14 @@ +--- +CONFIG: + log_level: notice + type: foss HOSTS: ubuntu1204: - roles: - - nodes - - ubuntu12 - platform: ubuntu-1204-amd64 - image: ubuntu:12.04 + docker_cmd: "[\"/sbin/init\"]" hypervisor: docker - docker_cmd: '["/sbin/init"]' - docker_image_commands: - - 'apt-get install -y iptables sudo' -CONFIG: - type: foss - log_level: notice + image: "ubuntu:12.04" + platform: ubuntu-1204-amd64 + roles: + - cassandra2 + - cassandra3 + - firewall diff --git a/spec/acceptance/nodesets/ubuntu1404.yml b/spec/acceptance/nodesets/ubuntu1404.yml index 74bd10c..ed367ff 100644 --- a/spec/acceptance/nodesets/ubuntu1404.yml +++ b/spec/acceptance/nodesets/ubuntu1404.yml @@ -1,18 +1,17 @@ --- -# Nasty hack with systemd due to issues found in #357. +CONFIG: + log_level: notice + type: foss HOSTS: ubuntu1404: - roles: - - master - - nodes - - ubuntu14 - platform: ubuntu-14.04-x64 - image: ubuntu:14.04 - hypervisor: docker docker_image_commands: - 'apt-get install -y iptables sudo systemd' - 'rm /bin/systemctl' - 'ln -s /bin/true /bin/systemctl' -CONFIG: - type: foss - log_level: notice + hypervisor: docker + image: "ubuntu:14.04" + platform: ubuntu-14.04-x64 + roles: + - cassandra2 + - cassandra3 + - firewall diff --git a/spec/acceptance/nodesets/ubuntu1604.yml b/spec/acceptance/nodesets/ubuntu1604.yml index 723022e..2443240 100644 --- a/spec/acceptance/nodesets/ubuntu1604.yml +++ b/spec/acceptance/nodesets/ubuntu1604.yml @@ -1,21 +1,18 @@ +--- +CONFIG: + log_level: debug + type: foss HOSTS: ubuntu1604: - roles: - - master - - ubuntu16 default_apply_opts: order: random - strict_variables: - platform: ubuntu-16.04-x64 - image: ubuntu:16.04 - hypervisor: docker + strict_variables: ~ + docker_cmd: "[\"/sbin/init\"]" docker_image_commands: - - 'apt-get install -y locales-all net-tools sudo ufw wget ntp python-pip python-minimal' - - 'rm -f /usr/sbin/policy-rc.d' - - '/usr/bin/wget http://launchpadlibrarian.net/109052632/python-support_1.0.15_all.deb' - - '/usr/bin/dpkg -i python-support_1.0.15_all.deb' - - '/usr/bin/pip install cassandra-driver' - docker_cmd: '["/sbin/init"]' -CONFIG: - type: foss - log_level: debug + - "apt-get install -y locales-all wget" + hypervisor: docker + image: "ubuntu:16.04" + platform: ubuntu-16.04-x64 + roles: + - cassandra3 + - firewall diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 45407aa..2996109 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,57 +1,506 @@ require 'beaker-rspec' require 'pry' -CASSANDRA2_UNSUPPORTED_PLATFORMS = ['16.04'].freeze +class TestManifests + def initialize(roles, version) + # Instance variables + @roles = roles + @version = version -thr = Thread.new do - loop do - sleep 1 - `sudo pkill agetty` + if version == 2.1 + init21 + elsif version == 2.2 + init22 + elsif version == 3.0 + init30 + end + end + + def init21 + @debian_release = '21x' + @debian_package_ensure = '2.1.17' + @redhat_package_ensure = '2.1.15-1' + @cassandra_optutils_package = 'cassandra21-tools' + @cassandra_package = 'cassandra21' + end + + def init22 + @debian_release = '22x' + @debian_package_ensure = '2.2.9' + @redhat_package_ensure = '2.2.8-1' + @cassandra_optutils_package = 'cassandra22-tools' + @cassandra_package = 'cassandra22' + end + + def init30 + @debian_release = '30x' + @debian_package_ensure = '3.0.13' + @redhat_package_ensure = '3.0.9-1' + @cassandra_optutils_package = 'cassandra30-tools' + @cassandra_package = 'cassandra30' + end + + def bootstrap_pp + <<-EOS + Exec { + path => [ + '/usr/local/bin', + '/opt/local/bin', + '/usr/bin', + '/usr/sbin', + '/bin', + '/sbin'], + logoutput => true, + } + + notify { "${::operatingsystem}-${::operatingsystemmajrelease}": } + + file { '/etc/dse': + ensure => directory, + } -> + file { '/etc/dse/dse-env.sh': + ensure => present, + content => "#export DSE_HOME\n# export HADOOP_LOG_DIR=", + } + + case downcase("${::operatingsystem}-${::operatingsystemmajrelease}") { + 'centos-6': { + package { ['gcc', 'tar', 'yum-utils', 'centos-release-scl']: } -> + exec { 'yum-config-manager --enable rhel-server-rhscl-7-rpms': } -> + package { ['ruby200', 'python27']: } -> + exec { 'cp /opt/rh/python27/enable /etc/profile.d/python.sh': } -> + exec { 'echo "\n" >> /etc/profile.d/python.sh': } -> + exec { 'echo "export PYTHONPATH=/usr/lib/python2.7/site-packages" >> /etc/profile.d/python.sh': } -> + exec { '/bin/cp /opt/rh/ruby200/enable /etc/profile.d/ruby.sh': } -> + exec { '/bin/rm /usr/bin/ruby /usr/bin/gem': } -> + exec { '/usr/sbin/alternatives --install /usr/bin/ruby ruby /opt/rh/ruby200/root/usr/bin/ruby 1000': } -> + exec { '/usr/sbin/alternatives --install /usr/bin/gem gem /opt/rh/ruby200/root/usr/bin/gem 1000': } + } + 'centos-7': { + package { ['gcc', 'tar', 'initscripts']: } + } + 'debian-7': { + package { ['sudo', 'ufw', 'wget']: } + } + 'debian-8': { + package { ['locales-all', 'net-tools', 'sudo', 'ufw']: } -> + file { '/usr/sbin/policy-rc.d': + ensure => absent, + } + } + 'ubuntu-12.04': { + package {['python-software-properties', 'iptables', 'sudo']:} -> + exec {'/usr/bin/apt-add-repository ppa:brightbox/ruby-ng':} -> + exec {'/usr/bin/apt-get update': } -> + package {'ruby2.0': } -> + exec { '/bin/rm /usr/bin/ruby': } -> + exec { '/usr/sbin/update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0 1000': } + } + 'ubuntu-16.04': { + package { ['locales-all', 'net-tools', 'sudo', 'ufw']: } -> + file { '/usr/sbin/policy-rc.d': + ensure => absent, + } + } + } + EOS + end + + def cassandra_install_pp + <<-EOS + if $::osfamily == 'Debian' { + class { 'cassandra::apache_repo': + release => '#{@debian_release}', + before => Class['cassandra', 'cassandra::optutils'], + } + + $package_ensure = '#{@debian_package_ensure}' + $cassandra_package = 'cassandra' + $cassandra_optutils_package = 'cassandra-tools' + } else { + class { 'cassandra::datastax_repo': + before => Class['cassandra', 'cassandra::optutils'], + } + $package_ensure = '#{@redhat_package_ensure}' + $cassandra_package = '#{@cassandra_package}' + $cassandra_optutils_package = '#{@cassandra_optutils_package}' + } + + require cassandra::system::swapoff + require cassandra::system::transparent_hugepage + include cassandra::java + + if versioncmp($::rubyversion, '1.9.0') < 0 { + $service_refresh = false + } else { + $service_refresh = true + } + + if #{@version} >= 3.0 { + class { 'cassandra': + hints_directory => '/var/lib/cassandra/hints', + package_ensure => $package_ensure, + package_name => $cassandra_package, + service_refresh => $service_refresh, + require => Class['cassandra::java'], + } + } else { + class { 'cassandra': + package_ensure => $package_ensure, + package_name => $cassandra_package, + service_refresh => $service_refresh, + require => Class['cassandra::java'], + } + } + + ## No longer required now using Apache Cassandra + # if $::lsbdistid == 'Ubuntu' { + # if $::operatingsystemmajrelease >= 16 { + # # Workarounds for amonst other things CASSANDRA-11850 + # Exec { + # environment => [ 'CQLSH_NO_BUNDLED=TRUE' ] + # } + # } + # } + + class { 'cassandra::optutils': + package_ensure => $package_ensure, + package_name => $cassandra_optutils_package, + require => Class['cassandra'] + } + + if $::osfamily == 'RedHat' { + class { 'cassandra::datastax_agent': + require => Class['cassandra'] + } + } + + #{firewall_pp} + include cassandra::dse + EOS + end + + def cassandra_uninstall_pp + <<-EOS + Exec { + path => [ + '/usr/bin', + '/bin' ], + logoutput => true, + } + if $::osfamily == 'RedHat' { + $cassandra_optutils_package = '#{@cassandra_optutils_package}' + $cassandra_package = '#{@cassandra_package}' + } else { + $cassandra_optutils_package = 'cassandra-tools' + $cassandra_package = 'cassandra' + } + service { 'cassandra': + ensure => stopped, + } -> + package { $cassandra_optutils_package: + ensure => purged, + } -> + package { $cassandra_package: + ensure => purged, + } -> + exec { 'rm -rf /var/lib/cassandra/*/* /var/log/cassandra/*': } + EOS + end + + def facts_testing_pp + <<-EOS + #{cassandra_install_pp} + + if $::osfamily == 'Debian' { + $package_comparison = $cassandrarelease + } else { + $package_comparison = "${cassandrarelease}-1" + } + + if $package_comparison != $package_ensure { + fail("cassandrarelease: ${package_comparison} != ${package_ensure}") + } + + if $::cassandramaxheapsize <= 0 { + fail('cassandramaxheapsize is not set.') + } + if $::cassandracmsmaxheapsize <= 0 { + fail('cassandracmsmaxheapsize is not set.') + } + if $::cassandraheapnewsize <= 0 { + fail('cassandraheapnewsize is not set.') + } + if $::cassandracmsheapnewsize <= 0 { + fail('cassandracmsheapnewsize is not set.') + } + EOS + end + + def firewall_pp + pp = if @roles.include? 'firewall' + <<-EOS + class { '::cassandra::firewall_ports': + require => Class['::cassandra'], + } + EOS + else + <<-EOS + # Firewall test skipped + EOS + end + pp + end + + def permissions_revoke_pp + <<-EOS + #{cassandra_install_pp} + class { 'cassandra::schema': + cqlsh_password => 'Niner2', + cqlsh_user => 'akers', + cqlsh_client_config => '/root/.puppetcqlshrc', + permissions => { + 'Revoke select permissions to spillman to all keyspaces' => { + ensure => absent, + permission_name => 'SELECT', + user_name => 'spillman', + }, + 'Revoke modify to to keyspace mykeyspace to akers' => { + ensure => absent, + keyspace_name => 'mykeyspace', + permission_name => 'MODIFY', + user_name => 'akers', + }, + 'Revoke alter permissions to mykeyspace to boone' => { + ensure => absent, + keyspace_name => 'mykeyspace', + permission_name => 'ALTER', + user_name => 'boone', + }, + 'Revoke ALL permissions to mykeyspace.users to gbennet' => { + ensure => absent, + keyspace_name => 'mykeyspace', + permission_name => 'ALTER', + table_name => 'users', + user_name => 'gbennet', + }, + }, + } + EOS + end + + def schema_create_pp + <<-EOS + #{cassandra_install_pp} + + $cql_types = { + 'fullname' => { + 'keyspace' => 'mykeyspace', + 'fields' => { + 'fname' => 'text', + 'lname' => 'text', + }, + }, + } + $keyspaces = { + 'mykeyspace' => { + ensure => present, + replication_map => { + keyspace_class => 'SimpleStrategy', + replication_factor => 1, + }, + durable_writes => false, + }, + } + class { 'cassandra::schema': + cql_types => $cql_types, + cqlsh_password => 'cassandra', + cqlsh_user => 'cassandra', + indexes => { + 'users_lname_idx' => { + keyspace => 'mykeyspace', + table => 'users', + keys => 'lname', + }, + }, + keyspaces => $keyspaces, + tables => { + 'users' => { + 'keyspace' => 'mykeyspace', + 'columns' => { + 'userid' => 'int', + 'fname' => 'text', + 'lname' => 'text', + 'PRIMARY KEY' => '(userid)', + }, + }, + }, + permissions => { + 'Grant select permissions to spillman to all keyspaces' => { + permission_name => 'SELECT', + user_name => 'spillman', + }, + 'Grant modify to to keyspace mykeyspace to akers' => { + keyspace_name => 'mykeyspace', + permission_name => 'MODIFY', + user_name => 'akers', + }, + 'Grant alter permissions to mykeyspace to boone' => { + keyspace_name => 'mykeyspace', + permission_name => 'ALTER', + user_name => 'boone', + }, + 'Grant ALL permissions to mykeyspace.users to gbennet' => { + keyspace_name => 'mykeyspace', + permission_name => 'ALTER', + table_name => 'users', + user_name => 'gbennet', + }, + }, + users => { + 'akers' => { + password => 'Niner2', + superuser => true, + }, + 'boone' => { + password => 'Niner75', + }, + 'gbennet' => { + password => 'Strewth', + }, + 'spillman' => { + password => 'Niner27', + }, + }, + } + EOS + end + + def schema_drop_index_pp + <<-EOS + #{cassandra_install_pp} + class { 'cassandra::schema': + cqlsh_user => 'akers', + cqlsh_password => 'Niner2', + indexes => { + 'users_lname_idx' => { + ensure => absent, + keyspace => 'mykeyspace', + table => 'users', + }, + }, + } + EOS + end + + def schema_drop_table_pp + <<-EOS + #{cassandra_install_pp} + class { 'cassandra::schema': + cqlsh_password => 'Niner2', + cqlsh_user => 'akers', + tables => { + 'users' => { + ensure => absent, + keyspace => 'mykeyspace', + }, + }, + } + EOS + end + + def schema_drop_keyspace_pp + <<-EOS + #{cassandra_install_pp} + $keyspaces = { + 'mykeyspace' => { + ensure => absent, + } + } + class { 'cassandra::schema': + cqlsh_password => 'Niner2', + cqlsh_user => 'akers', + keyspaces => $keyspaces, + } + EOS + end + + def schema_drop_type_pp + pp = <<-EOS + #{cassandra_install_pp} + $cql_types = { + 'fullname' => { + 'keyspace' => 'mykeyspace', + 'ensure' => 'absent' + } + } + class { 'cassandra::schema': + cql_types => $cql_types, + cqlsh_user => 'akers', + cqlsh_password => 'Niner2', + } + EOS + pp + end + + def schema_drop_user_pp + pp = <<-EOS + #{cassandra_install_pp} + class { 'cassandra::schema': + cqlsh_password => 'Niner2', + cqlsh_user => 'akers', + cqlsh_client_config => '/root/.puppetcqlshrc', + users => { + 'boone' => { + ensure => absent, + }, + }, + } + EOS + pp end end hosts.each do |host| case host.name when 'ubuntu1604' host.install_package('puppet') else install_puppet_on(host) end end RSpec.configure do |c| module_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) c.formatter = :documentation # Configure all nodes in nodeset c.before :suite do # Install modules puppet_module_install(source: module_root, module_name: 'cassandra') hosts.each do |host| on host, puppet('module', 'install', 'puppetlabs-apt'), acceptable_exit_codes: [0, 1] on host, puppet('module', 'install', 'puppetlabs-firewall'), acceptable_exit_codes: [0, 1] on host, puppet('module', 'install', 'puppetlabs-inifile'), acceptable_exit_codes: [0, 1] on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] # Install hiera write_hiera_config_on(host, [ 'environments/%{environment}/data/fqdn/%{fqdn}', 'environments/%{environment}/data/osfamily/%{osfamily}/%{lsbdistcodename}', 'environments/%{environment}/data/osfamily/%{osfamily}/%{lsbmajdistrelease}', 'environments/%{environment}/data/osfamily/%{osfamily}/%{architecture}', 'environments/%{environment}/data/osfamily/%{osfamily}/common', # 'environments/%{environment}/data/modules/%{cname}', 'environments/%{environment}/data/modules/%{caller_module_name}', 'environments/%{environment}/data/modules/%{module_name}', 'environments/%{environment}/data/common' ]) copy_hiera_data_to(host, './spec/acceptance/hieradata/') end end end - -thr.exit