summaryrefslogtreecommitdiff
path: root/vendor/supply_drop/test
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/supply_drop/test')
-rw-r--r--vendor/supply_drop/test/async_test.rb67
-rw-r--r--vendor/supply_drop/test/files/manifests/invalid.pp1
-rw-r--r--vendor/supply_drop/test/files/manifests/valid.pp9
-rw-r--r--vendor/supply_drop/test/files/templates/invalid.erb1
-rw-r--r--vendor/supply_drop/test/files/templates/valid.erb1
-rw-r--r--vendor/supply_drop/test/rsync_test.rb57
-rw-r--r--vendor/supply_drop/test/syntax_checker_test.rb23
7 files changed, 0 insertions, 159 deletions
diff --git a/vendor/supply_drop/test/async_test.rb b/vendor/supply_drop/test/async_test.rb
deleted file mode 100644
index 0b9bc3a..0000000
--- a/vendor/supply_drop/test/async_test.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-require 'test/unit'
-require File.expand_path('../../lib/supply_drop/util', __FILE__)
-require File.expand_path('../../lib/supply_drop/async_enumerable', __FILE__)
-require File.expand_path('../../lib/supply_drop/thread_pool', __FILE__)
-
-class AsyncTest < Test::Unit::TestCase
- def teardown
- SupplyDrop::Util.thread_pool_size = SupplyDrop::Util::DEFAULT_THREAD_POOL_SIZE
- end
-
- def test_can_enumerate_asynchronously
- collection = (1..10).to_a
- elapsed = timed do
- SupplyDrop::Util.optionally_async(collection, true).each do |item|
- sleep 0.1
- end
- end
- assert elapsed < 1
- end
-
- def test_can_enumerate_asynchronously_with_map
- collection = (1..10).to_a
- returned_values = nil
- elapsed = timed do
- returned_values = SupplyDrop::Util.optionally_async(collection, true).map do |item|
- sleep 0.1
- :somevalue
- end
- end
- assert returned_values == Array.new(10, :somevalue)
- assert elapsed < 1
- end
-
- def test_can_enumerate_normally_and_does_not_leak_after_extending
- collection = (1..10).to_a
- elapsed = timed do
- SupplyDrop::Util.optionally_async(collection, true).each do |item|
- sleep 0.1
- end
- end
- assert elapsed < 1
-
- elapsed = timed do
- SupplyDrop::Util.optionally_async(collection, false).each do |item|
- sleep 0.1
- end
- end
- assert elapsed >= 1
- end
-
- def test_can_configure_thread_pool_size
- collection = (1..10).to_a
- SupplyDrop::Util.thread_pool_size = 1
- elapsed = timed do
- returned_values = SupplyDrop::Util.optionally_async(collection, true).map do |item|
- sleep 0.1
- end
- end
- assert elapsed >= 1
- end
-
- def timed
- start = Time.now
- yield
- Time.now - start
- end
-end
diff --git a/vendor/supply_drop/test/files/manifests/invalid.pp b/vendor/supply_drop/test/files/manifests/invalid.pp
deleted file mode 100644
index 5ca851c..0000000
--- a/vendor/supply_drop/test/files/manifests/invalid.pp
+++ /dev/null
@@ -1 +0,0 @@
-class example {
diff --git a/vendor/supply_drop/test/files/manifests/valid.pp b/vendor/supply_drop/test/files/manifests/valid.pp
deleted file mode 100644
index d8e6486..0000000
--- a/vendor/supply_drop/test/files/manifests/valid.pp
+++ /dev/null
@@ -1,9 +0,0 @@
-class valid {
- file { "/etc/hosts":
- ensure => present,
- content => "127.0.0.1 localhost",
- owner => root,
- group => root,
- mode => "0644"
- }
-}
diff --git a/vendor/supply_drop/test/files/templates/invalid.erb b/vendor/supply_drop/test/files/templates/invalid.erb
deleted file mode 100644
index 615887c..0000000
--- a/vendor/supply_drop/test/files/templates/invalid.erb
+++ /dev/null
@@ -1 +0,0 @@
-this is a <%= if true %> template
diff --git a/vendor/supply_drop/test/files/templates/valid.erb b/vendor/supply_drop/test/files/templates/valid.erb
deleted file mode 100644
index 722efea..0000000
--- a/vendor/supply_drop/test/files/templates/valid.erb
+++ /dev/null
@@ -1 +0,0 @@
-this is a <%= "good" %> template
diff --git a/vendor/supply_drop/test/rsync_test.rb b/vendor/supply_drop/test/rsync_test.rb
deleted file mode 100644
index b51a6b3..0000000
--- a/vendor/supply_drop/test/rsync_test.rb
+++ /dev/null
@@ -1,57 +0,0 @@
-require 'test/unit'
-require File.expand_path('../../lib/supply_drop/rsync', __FILE__)
-
-class RsyncTest < Test::Unit::TestCase
-
- def test_build_simple_command
- command = SupplyDrop::Rsync.command('bar', 'foo')
- assert_equal 'rsync -az bar foo', command
- end
-
- def test_allows_passing_delete
- command = SupplyDrop::Rsync.command('bar', 'foo', :delete => true)
- assert_equal 'rsync -az --delete bar foo', command
- end
-
- def test_allows_specifying_an_exclude
- command = SupplyDrop::Rsync.command('bar', 'foo', :excludes => '.git')
- assert_equal 'rsync -az --exclude=.git bar foo', command
- end
-
- def test_ssh_options_keys_only_lists_existing_files
- command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :keys => [__FILE__, "#{__FILE__}dadijofs"] })
- assert_match /-i #{__FILE__}/, command
- end
-
- def test_ssh_options_ignores_keys_if_nil
- command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :keys => nil })
- assert_equal 'rsync -az . foo', command
- command = SupplyDrop::Rsync.command('bar', 'foo')
- assert_equal 'rsync -az bar foo', command
- end
-
- def test_ssh_options_config_adds_flag
- command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :config => __FILE__ })
- assert_equal %Q[rsync -az -e "ssh -F #{__FILE__}" . foo], command
- end
-
- def test_ssh_options_port_adds_port
- command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :port => '30022' })
- assert_equal %Q[rsync -az -e "ssh -p 30022" . foo], command
- end
-
- def test_ssh_options_ignores_config_if_nil_or_false
- command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :config => nil })
- assert_equal 'rsync -az . foo', command
- command = SupplyDrop::Rsync.command('.', 'foo', :ssh => { :config => false })
- assert_equal 'rsync -az . foo', command
- end
-
- def test_remote_address_concatinates_things_correctly
- assert_equal "user@box.local:/tmp", SupplyDrop::Rsync.remote_address('user', 'box.local', '/tmp')
- end
-
- def test_remote_address_drops_at_when_user_is_nil
- assert_equal 'box.local:/tmp', SupplyDrop::Rsync.remote_address(nil, 'box.local', '/tmp')
- end
-end
diff --git a/vendor/supply_drop/test/syntax_checker_test.rb b/vendor/supply_drop/test/syntax_checker_test.rb
deleted file mode 100644
index 15f6e73..0000000
--- a/vendor/supply_drop/test/syntax_checker_test.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'test/unit'
-require File.expand_path('../../lib/supply_drop/syntax_checker', __FILE__)
-
-class SyntaxCheckerTest < Test::Unit::TestCase
-
- def test_syntax_checks_puppet_files
- checker = SupplyDrop::SyntaxChecker.new(File.expand_path('../files', __FILE__))
- errors = checker.validate_puppet_files
- assert_equal 1, errors.count
- file, error = errors.first
- assert_match %r[manifests/invalid.pp$], file
- assert_match %r[expected '\}'], error
- end
-
- def test_synatx_checks_erb_files
- checker = SupplyDrop::SyntaxChecker.new(File.expand_path('../files', __FILE__))
- errors = checker.validate_templates
- assert_equal 1, errors.count
- file, error = errors.first
- assert_match %r[templates/invalid.erb$], file
- assert_match %r[syntax error], error
- end
-end