Skip to content

Commit

Permalink
Test tag mapping on images
Browse files Browse the repository at this point in the history
  • Loading branch information
cben committed Jan 3, 2018
1 parent 09f930a commit 518509f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/models/manageiq/providers/amazon/aws_refresher_spec_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1431,6 +1431,10 @@ def create_tag_mapping
@tag_mapping = FactoryGirl.create(:tag_mapping_with_category,
:label_name => "EmsRefreshSpecResourceGroupTag")
@tag_mapping_category = @tag_mapping.tag.classification

@image_tag_mapping = FactoryGirl.create(:tag_mapping_with_category,
:label_name => "Name", :labeled_resource_type => "Image")
@image_tag_mapping_category = @image_tag_mapping.tag.classification
end

# Tests can assert this if they called create_tag_mapping before refresh.
Expand All @@ -1444,4 +1448,19 @@ def assert_mapped_tags_on_vm
expect(vm.tags.first.category).to eq(@tag_mapping_category)
expect(vm.tags.first.classification.description).to eq("EmsRefreshSpecResourceGroupTagValue")
end

# Tests can assert this if they called create_tag_mapping before refresh.
def assert_mapped_tags_on_template
p @image_tag_mapping_category.children.collect(&:description)
expect(@image_tag_mapping_category.children.collect(&:description)).to include(
"suse-11-server-64",
"ubuntu-12.04-server-32",
# and many more...
)

template = ManageIQ::Providers::Amazon::CloudManager::Template.find_by(:name => "suse-11-server-64")
expect(template.tags.count).to eq(1)
expect(template.tags.first.category).to eq(@image_tag_mapping_category)
expect(template.tags.first.classification.description).to eq("suse-11-server-64")
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
end

assert_common
assert_mapped_tags_on_template
assert_mapped_tags_on_vm
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
end

assert_common
assert_mapped_tags_on_template
assert_mapped_tags_on_vm
end
end
Expand Down

0 comments on commit 518509f

Please sign in to comment.