elasticsearch-drain 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ require 'pp'
3
3
 
4
4
  class TestAutoScaling < Minitest::Test
5
5
  def setup
6
- VCR.insert_cassette 'autoscaling', record: :once
6
+ VCR.insert_cassette 'autoscaling', record: :new_episodes
7
7
  @asg = ::Elasticsearch::Drain::AutoScaling.new(
8
8
  'esuilogs-razor-d0prod-r01-v000',
9
9
  'us-east-1'
@@ -22,6 +22,12 @@ class TestAutoScaling < Minitest::Test
22
22
  assert_respond_to @asg.find_instances_in_asg, :each
23
23
  end
24
24
 
25
+ def test_missing_instance
26
+ assert_raises(::Elasticsearch::Drain::Errors::NodeNotFound) do
27
+ @asg.instance('1.1.1.1')
28
+ end
29
+ end
30
+
25
31
  def test_find_instances_matches_instance_pattern
26
32
  assert_match /i-[a-z0-9]{8}/, @asg.find_instances_in_asg.first
27
33
  end
@@ -34,4 +40,36 @@ class TestAutoScaling < Minitest::Test
34
40
  ip = @asg.instances.first
35
41
  assert private_ipaddress?(ip)
36
42
  end
43
+
44
+ # TODO: Figure out how to recode this...
45
+ def test_describe_asg_has_desired_capacity
46
+ disable_vcr do
47
+ asg = @asg.describe_autoscaling_group
48
+ assert_respond_to asg, :desired_capacity
49
+ end
50
+ end
51
+
52
+ # TODO: Figure out how to recode this...
53
+ def test_describe_asg_desired_capacity_equals
54
+ disable_vcr do
55
+ asg = @asg.describe_autoscaling_group
56
+ assert_equal 16, asg.desired_capacity
57
+ end
58
+ end
59
+
60
+ # TODO: Figure out how to recode this...
61
+ def test_describe_asg_has_min_size
62
+ disable_vcr do
63
+ asg = @asg.describe_autoscaling_group
64
+ assert_respond_to asg, :min_size
65
+ end
66
+ end
67
+
68
+ # TODO: Figure out how to recode this...
69
+ def test_describe_asg_has_min_size_equals
70
+ disable_vcr do
71
+ asg = @asg.describe_autoscaling_group
72
+ assert_equal 16, asg.min_size
73
+ end
74
+ end
37
75
  end
data/test/test_helper.rb CHANGED
@@ -14,8 +14,8 @@ require_relative '../lib/elasticsearch/drain'
14
14
  VCR.configure do |c|
15
15
  c.cassette_library_dir = 'test/cassettes'
16
16
  c.hook_into :webmock
17
- # c.debug_logger = $stderr
18
- # c.default_cassette_options = { allow_playback_repeats: true }
17
+ # c.debug_logger = $stderr
18
+ # c.default_cassette_options = { allow_playback_repeats: true }
19
19
  end
20
20
 
21
21
  def private_ipaddress?(ip)
@@ -24,3 +24,14 @@ def private_ipaddress?(ip)
24
24
  class_c = IPAddr.new('192.168.0.0/16')
25
25
  [class_a, class_b, class_c].any? { |i| i.include?(ip) }
26
26
  end
27
+
28
+ def disable_vcr(&block)
29
+ return skip unless ENV['ALLOW_DISABLED_VCR'] == 'true'
30
+ puts 'WARNING: Running with VCR disabled!'
31
+ VCR.eject_cassette
32
+ WebMock.allow_net_connect!
33
+ VCR.turned_off do
34
+ block.call
35
+ end
36
+ WebMock.disable_net_connect!
37
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-drain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Thompson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2015-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,6 +109,7 @@ files:
109
109
  - lib/elasticsearch/drain/cluster.rb
110
110
  - lib/elasticsearch/drain/node.rb
111
111
  - lib/elasticsearch/drain/nodes.rb
112
+ - lib/elasticsearch/drain/util.rb
112
113
  - lib/elasticsearch/drain/version.rb
113
114
  - test/cassettes/autoscaling.yml
114
115
  - test/cassettes/cluster.yml