Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve error handling and resource cleanup for PacketCapture (#6797)
The patch fixes the following issues: 1. The local pcap file was not closed on error. The patch ensures the file is closed regardless of success or failure. 2. The pcap file was not updated to `status.filePath` and was not uploaded to file server if not all packets have been captured. The patch ensures it's updated to status and uploaded as long as any packet is captured. 3. The Complete condition was not set correctly in one case. The patch uses two errors to track capturing error and uploading error separately. 4. The unit tests could report false negative as they only check that unexpected conditions don't exist, while they should check expected conditions exist. 5. Change the local pcap path's permission to 700. 6. Avoid panic when handling delete events containing DeletedFinalStateUnknown objects. 7. Reduce the min and max retry intervals to reduce the possibility of timeout. 8. Make a deepcopy before updating object got from lister, otherwise data race may happen and index may be messed up. 9. Add a readiness probe to the sftp server used in e2e test to avoid test flake. It also makes some style improvements and simplifies a few code. Signed-off-by: Quan Tian <[email protected]>
- Loading branch information