Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor MiqAeExportSpec to decrease test run time #72

Merged
merged 1 commit into from
Jul 25, 2014

Conversation

eclarizio
Copy link
Member

MiqAeExportSpec was our slowest spec, and these refactorings should turn the 30+ seconds that it used to take into about a second. Running all of the changed files (with some old tests that are still setting too much stuff up) takes about 4 seconds, so I'd consider this a significant speed up.

I also noticed that it was attempting to call to_export_xml on instances of CustomButton, but that method does not exist at all on CustomButton. It's implemented here as a placeholder, as I don't know enough about what should or should not be exported from a CustomButton.

@Fryguy
Copy link
Member

Fryguy commented Jun 23, 2014

@mkanoor @tinaafitz @gmcculloug Please review.

@eclarizio
Copy link
Member Author

Also in the process of getting rid of some of these rubocop warnings. Will likely not change most of the ones that are relevant to code I didn't modify but simply indented/moved.

@eclarizio
Copy link
Member Author

Leaving the rest of the Rubocops here.

For miq_ae_instance I would rather use the { } for blocks since we're calling a method on the end of the block.

For miq_ae_class_spec it's simply a long string of XML that I figured didn't need to be broken up into separate lines via the | operator. I will change it if that's a style thing we're going for, though.

miq_ae_field_spec and miq_ae_instance_spec warnings/style is from simply indenting code that did not otherwise change.

@miq-bot
Copy link
Member

miq-bot commented Jun 27, 2014

This pull request is not mergeable. Please rebase and repush.

xml_attrs = { :name => self.name, :namespace => self.namespace }

self.class.column_names.each { |cname|
# Remove any columns that we do not want to export
next if ["id", "created_on", "updated_on", "updated_by", "reserved"].include?(cname) || cname.ends_with?("_id")
next if %w(id created_on updated_on updated_by).include?(cname) || cname.ends_with?("_id")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was reserved removed from the list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I wrote the test, I tried to set up the different models with a "reserved" attribute, and it came back saying that column does not exist. So, originally it must've been copy/pasted from something that did have a reserved attribute.

@chessbyte
Copy link
Member

Since Travis is now green, please rebase to ensure that this PR continues to keep our tests passing.

@miq-bot
Copy link
Member

miq-bot commented Jul 8, 2014

This pull request is not mergeable. Please rebase and repush.

@@ -1,156 +1,196 @@
require "spec_helper"
require "debugger"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be here. It fails the specs because it's not in the Gemfile (and shouldn't be)

@miq-bot
Copy link
Member

miq-bot commented Jul 25, 2014

This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Jul 25, 2014

Checked commit eclarizio@08658d6 with rubocop 0.21.0
14 files checked, 45 offenses detected

vmdb/app/models/miq_ae_instance.rb

  • Style - Line 98, Col 52 - Blocks - Avoid using {...} for multi-line blocks.

vmdb/spec/models/miq_ae_class_spec.rb

vmdb/spec/models/miq_ae_datastore_spec.rb

vmdb/spec/models/miq_ae_field_spec.rb

  • Warn - Line 118, Col 28 - Void - Operator == used in void context.
  • Warn - Line 119, Col 33 - Void - Operator == used in void context.
  • Warn - Line 126, Col 28 - Void - Operator == used in void context.
  • Warn - Line 127, Col 33 - Void - Operator == used in void context.
  • Warn - Line 128, Col 33 - Void - Operator == used in void context.
  • Warn - Line 140, Col 42 - Void - Operator == used in void context.
  • Warn - Line 143, Col 42 - Void - Operator == used in void context.
  • Style - Line 50, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 60, Col 9 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 105, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 135, Col 43 - Blocks - Avoid using {...} for multi-line blocks.
  • Style - Line 145, Col 7 - WordArray - Use %w or %W for array of words.
  • Style - Line 145, Col 27 - Blocks - Avoid using {...} for multi-line blocks.

vmdb/spec/models/miq_ae_instance_spec.rb

  • Warn - Line 19, Col 37 - Void - Operator == used in void context.
  • Warn - Line 55, Col 42 - Void - Operator == used in void context.
  • Warn - Line 59, Col 42 - Void - Operator == used in void context.
  • Warn - Line 70, Col 38 - Void - Operator == used in void context.
  • Warn - Line 74, Col 38 - Void - Operator == used in void context.
  • Warn - Line 106, Col 54 - Void - Operator == used in void context.
  • Warn - Line 110, Col 54 - Void - Operator == used in void context.
  • Warn - Line 115, Col 64 - Void - Operator == used in void context.
  • Warn - Line 119, Col 64 - Void - Operator == used in void context.
  • Warn - Line 133, Col 37 - Void - Operator == used in void context.
  • Style - Line 32, Col 9 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 40, Col 9 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 54, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 58, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 62, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 63, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 69, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 73, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 82, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 83, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 86, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 87, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 114, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 118, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 132, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 140, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.
  • Style - Line 141, Col 7 - Lambda - Use the new lambda literal syntax ->(params) {...}.

gmcculloug added a commit that referenced this pull request Jul 25, 2014
Refactor MiqAeExportSpec to decrease test run time
@gmcculloug gmcculloug merged commit 8c49c2a into ManageIQ:master Jul 25, 2014
@eclarizio eclarizio deleted the refactor_miq_ae_export_spec branch October 9, 2015 16:46
simaishi pushed a commit that referenced this pull request Aug 14, 2017
Update provision requirements check to allow exact matches
(cherry picked from commit 48424c966ddbd2e58b536d4fa239a40466e8280f)

https://bugzilla.redhat.com/show_bug.cgi?id=1481449
simaishi pushed a commit that referenced this pull request Aug 15, 2017
Update provision requirements check to allow exact matches
(cherry picked from commit 48424c966ddbd2e58b536d4fa239a40466e8280f)

https://bugzilla.redhat.com/show_bug.cgi?id=1481869
d-m-u pushed a commit to d-m-u/manageiq that referenced this pull request Jun 6, 2018
Update provision requirements check to allow exact matches
(cherry picked from commit 48424c966ddbd2e58b536d4fa239a40466e8280f)

https://bugzilla.redhat.com/show_bug.cgi?id=1481449
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants