Skip to content

add missing diff socket logic#210

Open
hxadogar wants to merge 3 commits intocheckpoint-restore:mainfrom
hxadogar:socket-diff
Open

add missing diff socket logic#210
hxadogar wants to merge 3 commits intocheckpoint-restore:mainfrom
hxadogar:socket-diff

Conversation

@hxadogar
Copy link
Copy Markdown

diff --sockets was registered but not actually any compared logic.
now shows sockets added or removed.
it handles all socket types.

i have tested and verified manually.
and i will try to follow up with a dedicated pr for tests.

Signed-off-by: Hamza Dogar <hxadogar@gmail.com>
@adrianreber
Copy link
Copy Markdown
Member

Please add the tests to this PR as a second commit.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 26, 2026

Test Results

89 tests  +3   89 ✅ +3   4s ⏱️ -1s
 1 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit bb8f01e. ± Comparison against base commit 34f655f.

♻️ This comment has been updated with latest results.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 72.91667% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.98%. Comparing base (34f655f) to head (bb8f01e).

Files with missing lines Patch % Lines
cmd/diff.go 72.91% 24 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #210   +/-   ##
=======================================
  Coverage   79.98%   79.98%           
=======================================
  Files          16       16           
  Lines        1759     1854   +95     
=======================================
+ Hits         1407     1483   +76     
- Misses        263      281   +18     
- Partials       89       90    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hxadogar
Copy link
Copy Markdown
Author

of course, will add tests shortly.

for now here is my manual testing output:

➜ sudo ./checkpointctl diff socket-8080.tar socket-8081_8082.tar --sockets
╔════════════════════════════════════════════════════════════════╗
║ Checkpoint Diff                                                ║
╠════════════════════════════════════════════════════════════════╣
║ Container: socket-test                                         ║
║ Image:     localhost/socket-test:latest                        ║
║ ID:        2088c8c5543c036e2b706e2ca743cd41c86c81b03037a524... ║
╚════════════════════════════════════════════════════════════════╝

Checkpoint A:
  Created: 2026-03-26T16:53:05+05:00
  Size:    5551762 bytes

Checkpoint B:
  Created: 2026-03-26T16:53:05+05:00
  Size:    5551910 bytes

┌─ Memory Changes ─────────────────────────────────────────────┐
│ = No change
└──────────────────────────────────────────────────────────────┘
┌─ Process Changes ────────────────────────────────────────────┐
└──────────────────────────────────────────────────────────────┘
┌─ Socket Changes ─────────────────────────────────────────────┐
│ Added:
│   + PID 1     TCP     0.0.0.0:8081 -> 0.0.0.0:0
│   + PID 1     TCP     0.0.0.0:8082 -> 0.0.0.0:0
│ Removed:
│   - PID 1     TCP     0.0.0.0:8080 -> 0.0.0.0:0
└──────────────────────────────────────────────────────────────┘
Summary:
Checkpoint comparison for container socket-test
Sockets: +2 -1

Signed-off-by: Hamza Dogar <hxadogar@gmail.com>
@hxadogar
Copy link
Copy Markdown
Author

i have added bats tests and i think its ready for review

@adrianreber
Copy link
Copy Markdown
Member

Thanks. Also add a couple of unit tests, especially for the error cases which are not covered via bats tests.

Signed-off-by: Hamza Dogar <hxadogar@gmail.com>
@hxadogar
Copy link
Copy Markdown
Author

i added the unit tests and try to covered the error cases too (not too much)

you can take another look when you get time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants