-
Notifications
You must be signed in to change notification settings - Fork 165
Automated test to validate chargeback report #2792
Conversation
def cleanup_report(report): | ||
return lambda: _cleanup_report(report) | ||
|
||
request.addfinalizer(cleanup_report(report)) |
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.
@request.addfinalizer
def cleanup():
_cleanup_report(report)
enterprise.storageassign() | ||
|
||
|
||
class cost: |
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.
Two things here,
(1 Why use a class for this? Wouldn't a dict do?
(2 Is it supposed to be instantiated and used at the module level?
d7f88cf
to
251b168
Compare
10079d9
to
794dcc2
Compare
d901b3f
to
4393f80
Compare
for i, argvalue_tuple in enumerate(argvalues): | ||
args = dict(zip(argnames, argvalue_tuple)) | ||
|
||
try: |
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.
This section shouldn't be needed as you have the required fields above on line 20
09e5997
to
680ab4d
Compare
@nachandr The tests are missing tier marker, also maybe the test comments (descriptions) could be more elaborate with steps. |
229578d
to
7c6e76c
Compare
average_network_io = resource_usage['average_network_io'] | ||
average_disk_io = resource_usage['average_disk_io'] | ||
|
||
# Estimate Chargeback costs using default Chargeback rate and resource usage. |
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.
def calc_rate(rate_name, description, type)
with db.transaction:
providers = (
db.session.query(details.id)
.join(rates, details.chargeback_rate_id == rates.id)
.filter(details.metric == rate_name, rates.description == description,
rates.rate_type == type)
)
cpu_rate = db.session.query(details).filter(details.id.in_(
providers.subquery())).first().rate
cpu_rate = calc_rate('cpu_usagemhz_rate_average', 'Default', 'Compute')
cpu_used_cost = average_cpu_used_in_mhz * float(cpu_rate) / 24
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.
@psav Done.Taken care of that.
7c6e76c
to
51059ce
Compare
1512c9a
to
ac88ac9
Compare
ac88ac9
to
a4495c2
Compare
87cc170
to
0b7d2ed
Compare
cb_group = ac.Group(description='EvmGroup-super_administrator') | ||
user = ac.User(name=provider.name + fauxfactory.gen_alphanumeric(), | ||
credential=new_credential(), | ||
email='[email protected]', |
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.
@example.com
for example
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.
Done
9510eb6
to
3c8417a
Compare
31a043c
to
21d3faf
Compare
21d3faf
to
36ab74a
Compare
36ab74a
to
7093bf5
Compare
Lint report for commit 7093bf5: Everything seems all right 😄 . |
No description provided.