-
Bug
-
Resolution: Done
-
Major
-
None
-
None
-
False
-
None
-
False
-
-
It seems that the GCP credits are not included in OCP on ALL reports grouped by project.
Note that in case of group_by[node] and group_by[cluster], the credits are included as expected.
Also AWS credits seem to be included in all reports, we don't use Azure credits in testing at a moment.
Steps to reproduce:
1.run test_api_ocp_on_cloud_cost_validate_data_integrity
You can speed up the test by using only ocp_on_gcp and gcp single source fixtures:
def test_api_ocp_on_cloud_cost_validate_data_integrity( cost_ocp_on_gcp_source_static, cost_gcp_source_static, date_range, group_by, application, ):
ENV_FOR_DYNACONF=local iqe tests plugin cost_management -k test_api_ocp_on_cloud_cost_validate_data_integrity -vv --pdb
once the test fail
2. request OCP on GCP report, group_by[project]
/reports/openshift/infrastructures/gcp/costs/?group_by[project]=*&filter[cluster]=test_cost_ocp_on_gcp_cluster_kikis&start_date=2023-04-21&end_date=2023-04-21
In my case there were following costs for cluster_kikis for today:
project test_kikis:
raw value 101.75 + credit -5.93 = 95.82 (expected)
worker unallocated:
raw value 14.54 + credit -2.97 = 11.57 (expected)
Total: 95.82 + 11.57 = 107.39 (expected)
"data": [ { "date": "2023-04-21", "projects": [ { "project": "test_kikis", "values": [ { "date": "2023-04-21", "project": "test_kikis", "clusters": [ "test_cost_ocp_on_gcp_cluster_kikis" ], "source_uuid": [ "664e3d21-6b26-44f2-a767-331c859676b9" ], "classification": "project", "infrastructure": { "raw": { "value": 101.75129976383522, "units": "USD" }, "markup": { "value": 0.0, "units": "USD" }, "usage": { "value": 0.0, "units": "USD" }, "credit": { "value": -5.933020393576935, "units": "USD" }, "total": { "value": 95.8182793702583, "units": "USD" } }, "supplementary": {...}, "cost": { ... "total": { "value": 95.8182793702583, "units": "USD" } } } ] }, { "project": "Worker unallocated", "values": [ { "date": "2023-04-21", "project": "Worker unallocated", "clusters": [ "test_cost_ocp_on_gcp_cluster_kikis" ], "source_uuid": [ "664e3d21-6b26-44f2-a767-331c859676b9" ], "classification": "unallocated", "infrastructure": { "raw": { "value": 14.535899966262175, "units": "USD" }, "markup": { "value": 0.0, "units": "USD" }, "usage": { "value": 0.0, "units": "USD" }, "credit": { "value": -2.9665101971518646, "units": "USD" }, "total": { "value": 11.56938976911031, "units": "USD" } }, "supplementary": {...}, "cost": { ... "total": { "value": 11.56938976911031, "units": "USD" } } } ] } ] } ]
3. request OCP on All report, group_by[project]
/reports/openshift/infrastructures/all/costs/?group_by[project]=*&filter[cluster]=test_cost_ocp_on_gcp_cluster_kikis&start_date=2023-04-21&end_date=2023-04-21
You will see the same raw cost as in the case of OCP on GCP report (expected) , but the total cost is identical to raw cost (unexpected) - in my case (cluster_kikis for today):
project test_kikis: raw = total = 101.75 (unexpected)
worker unallocated: raw = total = 14.54 (unexpected)
[ { "date": "2023-04-21", "projects": [ { "project": "test_kikis", "values": [ { "date": "2023-04-21", "project": "test_kikis", "clusters": [ "test_cost_ocp_on_gcp_cluster_kikis" ], "source_uuid": [ "664e3d21-6b26-44f2-a767-331c859676b9" ], "classification": "project", "infrastructure": { "raw": { "value": 101.75129976383522, "units": "USD" }, "markup": { "value": 0.0, "units": "USD" }, "usage": { "value": 0.0, "units": "USD" }, "total": { "value": 101.75129976383522, "units": "USD" } }, "supplementary": {...}, "cost": { ... "total": { "value": 101.75129976383522, "units": "USD" } } } ] }, { "project": "Worker unallocated", "values": [ { "date": "2023-04-21", "project": "Worker unallocated", "clusters": [ "test_cost_ocp_on_gcp_cluster_kikis" ], "source_uuid": [ "664e3d21-6b26-44f2-a767-331c859676b9" ], "classification": "unallocated", "infrastructure": { "raw": { "value": 14.535899966262175, "units": "USD" }, "markup": { "value": 0.0, "units": "USD" }, "usage": { "value": 0.0, "units": "USD" }, "total": { "value": 14.535899966262175, "units": "USD" } }, "supplementary": {...} "cost": { ... "total": { "value": 14.535899966262175, "units": "USD" } } } ] } ] } ]
4. request OCP on ALL report , group_by[node]
/reports/openshift/infrastructures/all/costs/?group_by[node]=*&filter[cluster]=test_cost_ocp_on_gcp_cluster_kikis&start_date=2023-04-21&end_date=2023-04-21
You will see the same correct total cost as previously in OCP on GCP report - in my case 107.39 - indicating that credits were applied (expected)
[ { "date": "2023-04-21", "nodes": [ { "node": "test_gcp_kikis", "values": [ { "node": "test_gcp_kikis", "date": "2023-04-21", "clusters": [ "test_cost_ocp_on_gcp_cluster_kikis" ], "source_uuid": [ "664e3d21-6b26-44f2-a767-331c859676b9" ], "infrastructure": { "raw": { "value": 107.3876691393686, "units": "USD" }, "markup": { "value": 0.0, "units": "USD" }, "usage": { "value": 0.0, "units": "USD" }, "total": { "value": 107.3876691393686, "units": "USD" } }, "supplementary": {...}, "cost": { ... "total": { "value": 107.3876691393686, "units": "USD" } } } ] } ] } ]
5. request OCP on ALL report , group_by[cluster]
/reports/openshift/infrastructures/all/costs/?group_by[cluster]=*&filter[cluster]=test_cost_ocp_on_gcp_cluster_kikis&start_date=2023-04-21&end_date=2023-04-21
Again, you will see the same total cost as previously in OCP on GCP report - in my case 107.39 - indicating that credits were applied (expected)
[ { "cluster": "test_cost_ocp_on_gcp_cluster_kikis", "values": [ { "date": "2023-04-21", "cluster": "test_cost_ocp_on_gcp_cluster_kikis", "clusters": [ "test_cost_ocp_on_gcp_cluster_kikis" ], "source_uuid": [ "664e3d21-6b26-44f2-a767-331c859676b9" ], "infrastructure": { "raw": { "value": 107.3876691393686, "units": "USD" }, "markup": { "value": 0.0, "units": "USD" }, "usage": { "value": 0.0, "units": "USD" }, "total": { "value": 107.3876691393686, "units": "USD" } }, "supplementary": {...}, "cost": { ... "total": { "value": 107.3876691393686, "units": "USD" } } } ] } ]
- is related to
-
COST-2687 GCP credit is not used for calculation of OCP on Cloud instance-type values
- Closed