erikbocks commented on PR #11076:
URL: https://github.com/apache/cloudstack/pull/11076#issuecomment-4084844123

   Hello, @DaanHoogland, @bernardodemarco 
   
   After running the tests locally, I found that the errors in the integration 
tests were due to the error message returned as a response:
   
   ``` 
   2026-03-18 15:05:20,923 - CRITICAL - FAILED: 
test_only_owner_can_allocate_ip_in_quarantine_vpc: ['Traceback (most recent 
call last):\n', '  File "/usr/lib/python3.11/unittest/case.py", line 57, in 
testPartExecutor\n    yield\n', '  File "/usr/lib/python3.11/unittest/case.py", 
line 623, in run\n    self._callTestMethod(testMethod)\n', '  File 
"/usr/lib/python3.11/unittest/case.py", line 579, in _callTestMethod\n    if 
method() is not None:\n       ^^^^^^^^\n', '  File 
"/home/erik/test_quarantined_ips.py", line 171, in 
test_only_owner_can_allocate_ip_in_quarantine_vpc\n    self.assertIn(f"Failed 
to allocate public IP [{ip_address}] as it is in quarantine.",\n', '  File 
"/usr/lib/python3.11/unittest/case.py", line 1140, in assertIn\n    
self.fail(self._formatMessage(msg, standardMsg))\n', '  File 
"/usr/lib/python3.11/unittest/case.py", line 703, in fail\n    raise 
self.failureException(msg)\n', "AssertionError: 'Failed to allocate public IP 
[192.168.122.31] as it is in quarantine.' n
 ot found in 'Execute cmd: associateipaddress failed, due to: errorCode: 533, 
errorText:Insufficient address capacity'\n"]
   ```
   
   As it can be seen in the error message above, the test's assert expected the 
message to be `Failed to allocate public IP [192.168.122.31] as it is in 
quarantine.`, and the `Insufficient address capacity` message was being 
returned. The message discrepancy was due to this exception treatment present 
at the `ApiServer` class.
   
   
https://github.com/apache/cloudstack/blob/b744824f65813e01786d8a69ed82a4f49fe45e39/server/src/main/java/com/cloud/api/ApiServer.java#L727-L734
   
   In order to prevent that any future changes to exceptions treatments or 
messages could cause the same behavior, I changed the tests to search for the 
custom `533` code returned for every `InsufficientCapacityException` type 
exceptions response.
   
   I already ran the tests locally and they all passed successfully, but may we 
run the tests again? @DaanHoogland 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to