Class: EY::SnapshotMinder::Backend::Mock
- Inherits:
-
Object
- Object
- EY::SnapshotMinder::Backend::Mock
- Defined in:
- lib/ey-flex/snapshot_minder.rb
Instance Attribute Summary collapse
-
#commands_called ⇒ Object
readonly
Returns the value of attribute commands_called.
-
#raise_count ⇒ Object
Returns the value of attribute raise_count.
-
#total_wait_time ⇒ Object
readonly
Returns the value of attribute total_wait_time.
Instance Method Summary collapse
-
#initialize ⇒ Mock
constructor
A new instance of Mock.
- #list ⇒ Object
- #snapshot ⇒ Object
- #wait(seconds) ⇒ Object
Constructor Details
#initialize ⇒ Mock
Returns a new instance of Mock.
7 8 9 10 11 |
# File 'lib/ey-flex/snapshot_minder.rb', line 7 def initialize @commands_called = [] @raise_count = 0 @total_wait_time = 0 end |
Instance Attribute Details
#commands_called ⇒ Object (readonly)
Returns the value of attribute commands_called.
13 14 15 |
# File 'lib/ey-flex/snapshot_minder.rb', line 13 def commands_called @commands_called end |
#raise_count ⇒ Object
Returns the value of attribute raise_count.
14 15 16 |
# File 'lib/ey-flex/snapshot_minder.rb', line 14 def raise_count @raise_count end |
#total_wait_time ⇒ Object (readonly)
Returns the value of attribute total_wait_time.
13 14 15 |
# File 'lib/ey-flex/snapshot_minder.rb', line 13 def total_wait_time @total_wait_time end |
Instance Method Details
#list ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ey-flex/snapshot_minder.rb', line 29 def list @commands_called << "list_snapshots" [EY::InstanceAPIClient::Snapshot.new({ 'state' => 'in progres', 'progress' => '0%', 'volume_type' => 'db', 'snapshot_id' => 12, 'created_at' => Time.now.to_s })] end |
#snapshot ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/ey-flex/snapshot_minder.rb', line 20 def snapshot if @raise_count > 0 @raise_count -= 1 raise EY::InstanceAPIClient::Connection::UnexpectedStatus.new("") else @commands_called << "request_snapshot" end end |
#wait(seconds) ⇒ Object
16 17 18 |
# File 'lib/ey-flex/snapshot_minder.rb', line 16 def wait(seconds) @total_wait_time += seconds end |