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

[EUWE] Chargebacks for SCVMM (rollup-less) [2/2] #13554

Merged
merged 25 commits into from
Jan 18, 2017

Commits on Jan 18, 2017

  1. Drop hours_in_interval public interface

    of ChargebackRateDetail.
    
    (cherry picked from commit ae27ca5)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    96b46ad View commit details
    Browse the repository at this point in the history
  2. Drop @hours_in_interval instance variable on ChargebackRateDetail

    ChargebackRateDetail object should not know anything about some
    interval. It should just maintain the logic to calculate the cost.
    
    The @hours_in_interval is a function of given consumption slice.
    
    Moreover, there is a problem with @hours_in_interval -- the interval can
    be for instance one week, and the rate can be monthly, then we divide
    monthly cost by week. B@ng!
    
    (cherry picked from commit 09cecec)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    4f03ef6 View commit details
    Browse the repository at this point in the history
  3. Fix calculation inaccurancy when report period is not month

    When calculation hourly_rate for ChargebackRateDetail with monthly rate,
    we had assumed that lenght of report interval was good indicator of
    hours in month. This is however truth only for monthly reports.
    
    For example, assume monthly rate of $4 for fixed compute. On monthly
    report we charge correctly $4 (the hourly_rate is ($4 / 1.month). On
    weekly report, however we charge $4 per each week, as we assume that
    hourly_rate is ($4 / 1.week).
    
    (cherry picked from commit c3d3e85)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    d9e004b View commit details
    Browse the repository at this point in the history
  4. Split test cases for hourly rate

    (cherry picked from commit 4f7e02c)
    
    Conflicts:
    	spec/models/chargeback_rate_detail_spec.rb
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    5201958 View commit details
    Browse the repository at this point in the history
  5. Spec for monthly rate and weekly consumption slice combination

    (cherry picked from commit 3bfff04)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    e8ef837 View commit details
    Browse the repository at this point in the history
  6. Use let instead of class variable @admin

    The before branch is run many many times again and again creating admin
    user for no good.
    
    (cherry picked from commit e9b9e30)
    
    Conflicts:
    	spec/models/chargeback_vm_spec.rb
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    ed32a57 View commit details
    Browse the repository at this point in the history
  7. Extract user instance var to let(:user) clause

    (cherry picked from commit 2ac95eb)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    4f52e1e View commit details
    Browse the repository at this point in the history
  8. Do not use @options, use let(:options) instead

    (cherry picked from commit a300e10)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    b4f411a View commit details
    Browse the repository at this point in the history
  9. Define constants using let method

    (cherry picked from commit d8dafb4)
    
    Conflicts:
    	spec/models/chargeback_container_project_spec.rb
    	spec/models/chargeback_vm_spec.rb
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    aba51b0 View commit details
    Browse the repository at this point in the history
  10. Remove unused instance variable

    (cherry picked from commit 99ce628)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    470e6a3 View commit details
    Browse the repository at this point in the history
  11. Refactor: extract timestamp calculation

    (cherry picked from commit d5817ba)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    eb0b13c View commit details
    Browse the repository at this point in the history
  12. Do not create dozen of metric_rollups with hardcoded timestamp

    This code was definititelly meant to be written this way.
    
    (cherry picked from commit 385e8d2)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    8511fb2 View commit details
    Browse the repository at this point in the history
  13. refactor beginning of the month

    (cherry picked from commit 63141c0)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    1bdbd11 View commit details
    Browse the repository at this point in the history
  14. Refactor hours_in_month to let statement

    (cherry picked from commit bbe59f0)
    
    Conflicts:
    	spec/models/chargeback_vm_spec.rb
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    f56ac97 View commit details
    Browse the repository at this point in the history
  15. Refactor: extract @ems to let statement

    (cherry picked from commit 5cc0a3c)
    
    Conflicts:
    	spec/models/chargeback_container_project_spec.rb
    	spec/models/chargeback_vm_spec.rb
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    594d500 View commit details
    Browse the repository at this point in the history
  16. Refactor: Extract starting date

    and fix related rubocop
    
    (cherry picked from commit f870d3c)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    dc992ce View commit details
    Browse the repository at this point in the history
  17. Specs: should charge after the given time passed

    (cherry picked from commit 73c99b9)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    f7e1472 View commit details
    Browse the repository at this point in the history
  18. Do not charge for hours that are yet to come

    For variable_rate, we charge only that much that has been consumed.
    
    Perhaps I'll end the service tmrw, I should not be charged in advanced.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1402072
    (cherry picked from commit c94a8fb)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    24219e5 View commit details
    Browse the repository at this point in the history
  19. Do not hardcode time value, they should be relative report_run_time

    Otherwise, nobody will ever understand why we have them.
    
    Now each file includes single hardcoded datetime and everything else is
    relative to it. Think about it. That's actually meaning of the specs
    prescription. The hardcoded values were hardcoded to be relative to
    other hc values.
    
    (cherry picked from commit 4609f3c)
    
    Conflicts:
    	spec/models/chargeback_container_image_spec.rb
    	spec/models/chargeback_container_project_spec.rb
    	spec/models/chargeback_vm_spec.rb
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    0029941 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    70c9a58 View commit details
    Browse the repository at this point in the history
  21. Specs: resources should be created before their consumption

    We are gonna change code to charge only for consumption since the
    resource creation time. First, we need to make sure all our test subject
    have proper created_on timestamp.
    
    (cherry picked from commit e2d0561)
    
    Conflicts:
    	spec/models/chargeback_container_project_spec.rb
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    8b12151 View commit details
    Browse the repository at this point in the history
  22. Do not charge for hours before resource creation

    (cherry picked from commit 1317470)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    3b6b700 View commit details
    Browse the repository at this point in the history
  23. Charge SCVMM's vm only until it is retired.

    (cherry picked from commit 41e9832)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    79603b4 View commit details
    Browse the repository at this point in the history
  24. Do not yield consumption unless it represent real consumption

    When resource did not exist in given interval (day, week, month) we will
    not yield Consumption object into the chargeback engine.
    
    As a result the report won't contain rows with zero consumption.
    
    (cherry picked from commit 166896f)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    c0152ba View commit details
    Browse the repository at this point in the history
  25. A typo fix.

    Nice catch @lpichler!
    
    (cherry picked from commit 3703d88)
    isimluk committed Jan 18, 2017
    Configuration menu
    Copy the full SHA
    1ef7a98 View commit details
    Browse the repository at this point in the history