-
Notifications
You must be signed in to change notification settings - Fork 145
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
Improve Compute coverage #394
Conversation
Something's up with GitHub - PR's no longer update :| Wrote to support - I'll revisit this tomorrow. |
Codecov Report
@@ Coverage Diff @@
## master #394 +/- ##
==========================================
+ Coverage 83.44% 85.49% +2.05%
==========================================
Files 339 114 -225
Lines 5762 2117 -3645
==========================================
- Hits 4808 1810 -2998
+ Misses 954 307 -647
Continue to review full report at Codecov.
|
# Grab the test suit name from the example | ||
suit_name = [@example].join("_").gsub(/\W/, "").tr("_", "-").downcase.split('-')[0] | ||
# Select all resources matching the test suite | ||
resources = @subject.all.select { |resource| resource.name.match? /#{PREFIX}-[0-9]*-#{suit_name}/ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/AmbiguousRegexpLiteral: Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
@@ -8,7 +8,10 @@ def initialize(subject, example) | |||
end | |||
|
|||
def cleanup(async = false) | |||
resources = @subject.all.select { |resource| resource.name.start_with? PREFIX } | |||
# Grab the test suit name from the example | |||
suit_name = [@example].join("_").gsub(/\W/, "").tr("_", "-").downcase.split('-')[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
4f0be9f
to
d1c537f
Compare
d1c537f
to
8ca0339
Compare
This should be mostly a no-op, just a logical improvement. Waiting for !PENDING may cause some issues when operation is in a transitional state or they add another status to an operation on the backend.
This will make it easier to spot long-running tests and get results from CI quicker.
In theory this isn’t even needed as the bottom routine actually waits for resources to disappear from the listing: ``` resources.each { |r| Fog.wait_for { !@subject.all.map(&:identity).include? r.identity } } ```
We’ll need to parallelise CI more so trying to split test cleanup once more
if DEBUG | ||
p "Cleanup invoked in #{self} for example: #{@example}" | ||
p "Resources to be deleted: #{resources.map { |r| r.name }}" | ||
p "All subject resources: #{@subject.all.map { |s| s.name }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/SymbolProc: Pass &:name as an argument to map instead of a block.
resources = @subject.all.select { |resource| resource.name.match? /#{PREFIX}-[0-9]*-#{suit_name}/ } | ||
if DEBUG | ||
p "Cleanup invoked in #{self} for example: #{@example}" | ||
p "Resources to be deleted: #{resources.map { |r| r.name }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/SymbolProc: Pass &:name as an argument to map instead of a block.
def cleanup(async = false) | ||
resources = @subject.all.select { |resource| resource.name.start_with? PREFIX } | ||
suit_name = @example.gsub(/\W/, "").tr("_", "-").downcase.split('-')[0] | ||
resources = @subject.all.select { |resource| resource.name.match? /#{PREFIX}-[0-9]*-#{suit_name}/ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/AmbiguousRegexpLiteral: Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
def cleanup(async = false) | ||
resources = @subject.all.select { |resource| resource.name.start_with? PREFIX } | ||
suit_name = @example.gsub(/\W/, "").tr("_", "-").downcase.split('-')[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -5,6 +5,9 @@ | |||
# XXX not sure if this will work on Travis CI or not | |||
Fog.credential = :test | |||
|
|||
# Enable test debugging, providing additional information in some methods | |||
DEBUG = ENV['DEBUG'] || false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
if DEBUG | ||
p "Cleanup invoked in #{self} for example: #{@example}" | ||
p "Resources to be deleted: #{resources.map { |r| r.name }}" | ||
p "All subject resources: #{@subject.all.map { |s| s.name }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/SymbolProc: Pass &:name as an argument to map instead of a block.
resources = @subject.all.select { |resource| resource.name.match? /#{PREFIX}-[0-9]*-#{suit_name}/ } | ||
if DEBUG | ||
p "Cleanup invoked in #{self} for example: #{@example}" | ||
p "Resources to be deleted: #{resources.map { |r| r.name }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/SymbolProc: Pass &:name as an argument to map instead of a block.
def cleanup(async = false) | ||
resources = @subject.all.select { |resource| resource.name.start_with? PREFIX } | ||
suit_name = @example.gsub(/\W/, "").tr("_", "-").downcase.split('-')[0] | ||
resources = @subject.all.select { |resource| resource.name.match? /#{PREFIX}-[0-9]*-#{suit_name}/ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lint/AmbiguousRegexpLiteral: Ambiguous regexp literal. Parenthesize the method arguments if it's surely a regexp literal, or add a whitespace to the right of the / if it should be a division.
def cleanup(async = false) | ||
resources = @subject.all.select { |resource| resource.name.start_with? PREFIX } | ||
suit_name = @example.gsub(/\W/, "").tr("_", "-").downcase.split('-')[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -5,6 +5,9 @@ | |||
# XXX not sure if this will work on Travis CI or not | |||
Fog.credential = :test | |||
|
|||
# Enable test debugging, providing additional information in some methods | |||
DEBUG = ENV['DEBUG'] || false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
cbff6d2
to
eb3e6e6
Compare
Alright, merging this. I'll need to parallelise things though. It now takes literally 2 hours. |
Server is our most complicated model but it has the worst test coverage.
This is trying to improve it and fix the docs while I'm at it.
Due to the need to instantiate a bunch of servers during the test this slows them down quite a bit...
Looking at ballpark figures - 73 minutes :|
I'll start thinking about speeding things up. I think we can parallelise things more, but that requires careful planning of cleanup (since different API's can trump eachother).