Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# Return the name of a platform-specific package known to be installed on a system
def known_installed_package
case default['platform']
when /solaris.*11/
"shell/bash"
when /solaris.*10/
"SUNWbash"
when /windows/
"bash"
else
Expand Down Expand Up @@ -42,26 +38,6 @@ def known_installed_package
end
end

confine_block :to, :platform => /solaris/ do
step "#check_for_package will return false if the specified package is not installed on the remote host" do
result = check_for_package default, "non-existent-package-name"

assert !result
end

step "#check_for_package will return true if the specified package is installed on the remote host" do
result = check_for_package default, known_installed_package

assert result
end

step "#check_for_package CURRENTLY fails if given a host array" do
assert_raises NoMethodError do
check_for_package hosts, known_installed_package
end
end
end

confine_block :to, :platform => /osx/ do
step "#check_for_package CURRENTLY fails with a RuntimeError on OS X" do
assert_raises RuntimeError do
Expand All @@ -70,7 +46,7 @@ def known_installed_package
end
end

confine_block :except, :platform => /windows|solaris|osx/ do
confine_block :except, :platform => /windows|osx/ do
step "#check_for_package will return false if the specified package is not installed on the remote host" do
result = check_for_package default, "non-existent-package-name"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,11 +188,7 @@ def create_remote_file_with_backups host, remote_filename, contents, opts = {}
hosts.each do |host|
if !host[:rsync_installed]
# rsync wasn't installed on #{host} when we started, so we should clean up after ourselves
rsync_package = "rsync"
# solaris-10 uses OpenCSW pkgutil, which prepends "CSW" to its provided packages
# TODO: fix this with BKR-1502
rsync_package = "CSWrsync" if host['platform'].include?('solaris-10')
host.uninstall_package rsync_package
host.uninstall_package('rsync')
end
host.delete(:rsync_installed)
end
Expand Down
12 changes: 2 additions & 10 deletions acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ def rsync_to_with_backups hosts, local_filename, remote_dir
hosts.each do |host|
if host.check_for_package('rsync')
host[:rsync_installed] = true
rsync_package = "rsync"
# solaris-10 uses OpenCSW pkgutil, which prepends "CSW" to its provided packages
# TODO: fix this with BKR-1502
rsync_package = "CSWrsync" if host['platform'].include?('solaris-10')
host.uninstall_package rsync_package
host.uninstall_package('rsync')
else
host[:rsync_installed] = false
end
Expand Down Expand Up @@ -169,11 +165,7 @@ def rsync_to_with_backups hosts, local_filename, remote_dir
hosts.each do |host|
if !host[:rsync_installed]
# rsync wasn't installed on #{host} when we started, so we should clean up after ourselves
rsync_package = "rsync"
# solaris-10 uses OpenCSW pkgutil, which prepends "CSW" to its provided packages
# TODO: fix this with BKR-1502
rsync_package = "CSWrsync" if host['platform'].include?('solaris-10')
host.uninstall_package rsync_package
host.uninstall_package('rsync')
end
host.delete(:rsync_installed)
end
Expand Down
122 changes: 1 addition & 121 deletions acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,127 +9,7 @@
end
end

confine_block :to, :platform => /solaris/ do
step "#run_cron_on CURRENTLY does nothing and returns `nil` when an unknown command is provided" do
# NOTE: would have expected this to raise Beaker::Host::CommandFailure instead

assert_nil run_cron_on default, :nonexistent_action, default['user']
end

step "#run_cron_on CURRENTLY does not fail when listing cron jobs for an unknown user" do
assert_raises Beaker::Host::CommandFailure do
run_cron_on default, :list, "nonexistentuser"
end
end

step "#run_cron_on CURRENTLY does not fail when listing cron jobs for a user with no cron entries" do
result = run_cron_on default, :list, default['user']

assert_equal 0, result.exit_code
end

step "#run_cron_on returns a list of cron jobs for a user with cron entries" do
# this basically requires us to add a cron entry to make this work
run_cron_on default, :add, default['user'], "* * * * * /bin/ls >/dev/null"
result = run_cron_on default, :list, default['user']

assert_equal 0, result.exit_code
assert_match %r{/bin/ls}, result.stdout
end

step "#run_cron_on CURRENTLY does not fail, but returns nil, when adding cron jobs for an unknown user" do
result = run_cron_on default, :add, "nonexistentuser", %{* * * * * /bin/echo "hello" >/dev/null}

assert_nil result
end

step "#run_cron_on CURRENTLY does not fail, but returns nil, when attempting to add a bad cron entry" do
result = run_cron_on default, :add, default['user'], "* * * * /bin/ls >/dev/null"

assert_nil result
end

step "#run_cron_on can add a cron job for a user on a host" do
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "hello" >/dev/null}
result = run_cron_on default, :list, default['user']

assert_equal 0, result.exit_code
assert_match %r{/bin/echo}, result.stdout
end

step "#run_cron_on CURRENTLY replaces all of user's cron jobs with any newly added jobs" do
# NOTE: would have expected this to append new entries, or manage them as puppet manages
# cron entries. See also: https://github.com/puppetlabs/beaker/pull/937#discussion_r38338494

1.upto(3) do |job_number|
run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "job :#{job_number}:" >/dev/null}
end

result = run_cron_on default, :list, default['user']

refute_match %r{job :1:}, result.stdout
refute_match %r{job :2:}, result.stdout
assert_match %r{job :3:}, result.stdout
end

step "#run_cron_on :remove CURRENTLY removes all cron jobs for a user on a host" do
# NOTE: would have expected a more granular approach to removing cron jobs
# for a user on a host. This should otherwise be better documented.

run_cron_on default, :add, default['user'], %{* * * * * /bin/echo "quality: job 1" >/dev/null}
result = run_cron_on default, :list, default['user']

assert_match %r{quality: job 1}, result.stdout

run_cron_on default, :remove, default['user']

assert_raises Beaker::Host::CommandFailure do
run_cron_on default, :list, default['user']
end
end

step "#run_cron_on fails when removing cron jobs for an unknown user" do
assert_raises Beaker::Host::CommandFailure do
run_cron_on default, :remove, "nonexistentuser"
end
end

step "#run_cron_on can list cron jobs for a user on all hosts when given a host array" do
hosts.each do |host|
# this basically requires us to add a cron entry to make this work
run_cron_on host, :add, host['user'], "* * * * * /bin/ls >/dev/null"
end

results = run_cron_on hosts, :list, default['user']

results.each do |result|
assert_match %r{/bin/ls}, result.stdout
end
end

step "#run_cron_on can add cron jobs for a user on all hosts when given a host array" do
run_cron_on hosts, :add, default['user'], "* * * * * /bin/ls >/dev/null"

results = run_cron_on hosts, :list, default['user']

results.each do |result|
assert_match %r{/bin/ls}, result.stdout
end
end

step "#run_cron_on can remove cron jobs for a user on all hosts when given a host array" do
run_cron_on hosts, :add, default['user'], "* * * * * /bin/ls >/dev/null"
run_cron_on hosts, :remove, default['user']

hosts.each do |host|
assert_raises Beaker::Host::CommandFailure do
run_cron_on host, :list, host['user']
end
end
end
end

confine_block :except, :platform => /windows|solaris/ do
confine_block :except, :platform => /windows/ do
step "#run_cron_on CURRENTLY does nothing and returns `nil` when an unknown command is provided" do
# NOTE: would have expected this to raise Beaker::Host::CommandFailure instead

Expand Down
7 changes: 0 additions & 7 deletions acceptance/tests/base/host/packages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,8 @@
next if host['platform'].include?('windows')

package = 'zsh'
package = 'CSWzsh' if host['platform'].include?('solaris-10')
package = 'git' if /opensuse|sles/.match?(host['platform'])

if host['platform'].include?('solaris-11')
logger.debug("#{package} should be uninstalled on #{host}")
host.uninstall_package(package)
assert_equal(false, host.check_for_package(package), "'#{package}' should not be installed")
end

assert_equal(false, host.check_for_package(package), "'#{package}' not should be installed")
logger.debug("#{package} should be installed on #{host}")
cmdline_args = ''
Expand Down
2 changes: 1 addition & 1 deletion acceptance/tests/base/host/packages_unix.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
test_name 'confirm unix-specific package methods work'
confine :except, :platform => %w(windows solaris osx)
confine :except, :platform => %w(windows osx)

step '#update_apt_if_needed : can execute without raising an error'
hosts.each do |host|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
end
end

confine_block :to, :platform => /solaris-10/ do
step "confirm /opt/csw/bin has been added to the path" do
hosts.each do |host|
assert_equal(0, on(host, "grep \"/opt/csw/bin\" #{host[:ssh_env_file]}").exit_code)
end
end
end

confine_block :to, :platform => /openbsd/ do
step "confirm PKG_PATH is set in the ssh environment file" do
hosts.each do |host|
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/argument_processing_and_precedence.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ Usage: beaker [options...]
(default: slow)
--[no-]ntp Sync time on SUTs before testing
(default: false)
--repo-proxy Proxy packaging repositories on ubuntu, debian and solaris-11
--repo-proxy Proxy packaging repositories on ubuntu and debian
(default: false)
--package-proxy URL Set proxy url for package managers (yum and apt)
--[no-]validate Validate that SUTs are correctly provisioned before running tests
Expand Down
2 changes: 1 addition & 1 deletion docs/concepts/style_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ skip_test 'requires puppet and mcollective service scripts from AIO agent packag
```
**Bad:**
```ruby
confine :to, :platform => 'solaris:pending'
confine :to, :platform => 'windows:pending'
```

## Confining
Expand Down
10 changes: 0 additions & 10 deletions docs/how_to/hypervisors/solaris.md

This file was deleted.

3 changes: 1 addition & 2 deletions docs/tutorials/creating_a_test_environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To properly define a host you must provide:
Additionally, Beaker supports the following host options:

* ip: The IP address of the SUT.
* hypervisor: One of `docker`, `solaris`, `ec2`, `vsphere`, `fusion`, `aix`, `vcloud` or `vagrant`.
* hypervisor: One of `docker`, `ec2`, `vsphere`, `fusion`, `aix`, `vcloud` or `vagrant`.
* Additional settings may be required depending on the selected hypervisor (ie, template, box, box_url, etc). Check the documentation below for your hypervisor for details.
* snapshot: The name of the snapshot to revert to before testing.
* roles: In a single-host setup roles are optional. Roles describe the 'job' of a host, an array of `master`, `agent`, `frictionless`, `dashboard`, `database`, `default` or any user-defined string.
Expand All @@ -74,7 +74,6 @@ The platform's format is `/^OSFAMILY-VERSION-ARCH.*$/` where `OSFAMILY` is one o
* opensuse
* ubuntu
* windows
* solaris
* aix
* el (covers centos, redhat and enterprise linux)

Expand Down
10 changes: 1 addition & 9 deletions lib/beaker/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,13 @@ class SedCommand < Command
#
# the purpose is to abstract away platform-dependent details of the sed command
#
# @param [String] platform The host platform string
# @param [String] expression The sed expression
# @param [String] filename The file to apply the sed expression to
# @param [Hash{Symbol=>String}] opts Additional options
# @option opts [String] :temp_file The temp file to use for in-place substitution
# (only applies to solaris hosts, they don't provide the -i option)
#
# @return a new {SedCommand} object
def initialize platform, expression, filename, opts = {}
def initialize expression, filename, opts = {}
command = "sed -i -e \"#{expression}\" #{filename}"
if /solaris|aix|osx|openbsd/.match?(platform)
command.slice! '-i '
temp_file = opts[:temp_file] ? opts[:temp_file] : "#{filename}.tmp"
command << " > #{temp_file} && mv #{temp_file} #{filename} && rm -f #{temp_file}"
end
args = []
opts['ENV'] ||= {}
super(command, args, opts)
Expand Down
2 changes: 1 addition & 1 deletion lib/beaker/dsl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module Beaker
#
# @example Writing a complete testcase to be ran by the builtin test runner.
# test_name 'Ensure My App Starts Correctly' do
# confine :except, :platform => ['windows', 'solaris']
# confine :except, :platform => ['windows']
#
# teardown do
# on master, puppet('resource mything ensure=absent')
Expand Down
2 changes: 1 addition & 1 deletion lib/beaker/dsl/helpers/host_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ def retry_on(host, command, opts = {}, &)
def run_cron_on(host, action, user, entry = "", &block)
block_on host do |host|
platform = host['platform']
if platform.include?('solaris') || platform.include?('aix') then
if platform.include?('aix') then
case action
when :list then args = '-l'
when :remove then args = '-r'
Expand Down
10 changes: 5 additions & 5 deletions lib/beaker/dsl/structure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ def expect_failure(explanation)
# @example Basic usage to confine to debian OSes.
# confine :to, :platform => 'debian'
#
# @example Confining to anything but Windows and Solaris
# confine :except, :platform => ['windows', 'solaris']
# @example Confining to anything but Windows
# confine :except, :platform => ['windows']
#
# @example Using additional block to confine to Solaris global zone.
# confine :to, :platform => 'solaris' do |solaris|
# on( solaris, 'zonename' ) =~ /global/
# @example Using additional block to confine to EL with firewalld
# confine :to, :platform => 'el' do |host|
# on(host, 'firewall-cmd --state').stdout == 'running'
# end
#
# @example Confining to an already defined subset of hosts
Expand Down
9 changes: 1 addition & 8 deletions lib/beaker/host/unix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,7 @@ def determine_ssh_server
end

def external_copy_base
@external_copy_base ||= begin
if self['platform'].variant == 'solaris' && self['platform'].version == '10'
# Solaris 10 uses / as the root user directory. Solaris 11 uses /root (like most).
'/'
else
'/root'
end
end
'/root'
end

# Tells you whether a host platform supports beaker's
Expand Down
Loading