lib/stubs/aws_stubs.rb in cloud_powers-0.2.7.22 vs lib/stubs/aws_stubs.rb in cloud_powers-0.2.7.23

- old
+ new

@@ -72,10 +72,11 @@ # * defaults can't be overriden or don't have good support for # for it yet but you can use this hash as a guide # for your own custom configuration def self.node_stub(opts = {}) time = opts[:launch_time] || Time.new((Time.now.utc.to_i / 86400 * 86400)) # midnight + tags = [{key: 'task', value: 'test'}] { stub_responses: { create_tags: {}, run_instances: { instances: [ @@ -86,15 +87,15 @@ { instance_id: 'lkj-0987', launch_time: time, state: { name: 'running' } }, ]}, describe_instances: { reservations: [ { instances: [ - { instance_id: 'asd-1234', state: { code: 200, name: 'running' } }, - { instance_id: 'qwe-4323', state: { code: 200, name: 'running' } }, - { instance_id: 'tee-4322', state: { code: 200, name: 'running' } }, - { instance_id: 'bbf-6969', state: { code: 200, name: 'running' } }, - { instance_id: 'lkj-0987', state: { code: 200, name: 'running' } } + { instance_id: 'asd-1234', state: { code: 200, name: 'running' }, tags: tags }, + { instance_id: 'qwe-4323', state: { code: 200, name: 'running' }, tags: tags }, + { instance_id: 'tee-4322', state: { code: 200, name: 'running' }, tags: tags }, + { instance_id: 'bbf-6969', state: { code: 200, name: 'running' }, tags: tags }, + { instance_id: 'lkj-0987', state: { code: 200, name: 'running' }, tags: tags } ] }] }, describe_images: { images: [ { image_id: 'asdf', state: 'available' }, { image_id: 'fdas', state: 'available' }, @@ -306,9 +307,24 @@ md5_of_message_attributes: "00484c68...59e48f06", md5_of_message_body: "51b0a325...39163aa0", message_id: "da68f62c-0c07-4bee-bf5f-7e856EXAMPLE" } } + }.merge(opts) + end + + # Stub metadata for EC2 tags + # + # Notes + # * defaults can't be overriden or don't have good support for + # for it yet but you can use this hash as a guide + # for your own custom configuration + def self.instance_tags_stub(opts = {}) + { + tags: [ + { key: 'tag_one_key', value: 'tag_one_value' }, + { key: 'tag_two_key', value: 'tag_two_value' } + ] }.merge(opts) end end end end