Open chandrams opened 1 year ago
For a few json keys like kubernetes_objects if not specified it gives 500 response code instead of 400
> assert response.status_code == expected_status_code, \
f"Mandatory field check failed for {field} actual - {response.status_code} expected - {expected_status_code}"
E AssertionError: Mandatory field check failed for kubernetes_objects actual - 500 expected - 400
E assert 500 == 400
E + where 500 = <Response [500]>.status_code
test_create_experiment.py:415: AssertionError
------------------------------Captured stdout call------------------------------
KRUIZE AUTOTUNE URL = http://10.88.0.2:31204
*****************************************
[{'version': '1.0', 'cluster_name': 'cluster-one-division-bell', 'experiment_name': 'quarkus-resteasy-kruize-min-http-response-time-db', 'performance_profile': 'resource-optimization-openshift', 'mode': 'monitor', 'target_cluster': 'remote', 'trial_settings': {'measurement_duration': '15min'}, 'recommendation_settings': {'threshold': '0.1'}}]
*****************************************
Deleting the experiment...
URL = http://10.88.0.2:31204/createExperiment
<Response [400]>
Response status code = 400
delete exp = 400
************************************************************
[{'version': '1.0', 'cluster_name': 'cluster-one-division-bell', 'experiment_name': 'quarkus-resteasy-kruize-min-http-response-time-db', 'performance_profile': 'resource-optimization-openshift', 'mode': 'monitor', 'target_cluster': 'remote', 'trial_settings': {'measurement_duration': '15min'}, 'recommendation_settings': {'threshold': '0.1'}}]
************************************************************
Creating the experiment...
URL = http://10.88.0.2:31204/createExperiment
<Response [500]>
Response status code = 500
Internal Server Error: Cannot invoke "java.util.List.iterator()" because "kubernetesAPIObjectsList" is null
We're getting this error now with the latest code:
{
"message": "Cannot invoke \"Object.hashCode()\" because \"key\" is null",
"httpcode": 500,
"documentationLink": "",
"status": "ERROR"
}
Include validation for the remote monitoring API jsons to validate the mandatory keys, value types. Could look at json schema validation