Skip to content

manager/csi: fakeIdentityClient, fakeControllerClient: embed interface - #3256

Open
thaJeztah wants to merge 1 commit into
moby:masterfrom
thaJeztah:decouple_csi
Open

manager/csi: fakeIdentityClient, fakeControllerClient: embed interface#3256
thaJeztah wants to merge 1 commit into
moby:masterfrom
thaJeztah:decouple_csi

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Jul 25, 2026

Copy link
Copy Markdown
Member

Make sure the fake clients satisfies the CSI interface if new methods are added to it that are unused in SwarmKit's implementation. Also remove the GetPluginInfo stub method, as it's not used in SwarmKit's implementation.

- What I did

- How I did it

- How to test it

- Description for the changelog

@codecov-commenter

codecov-commenter commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 14.74%. Comparing base (6e9e7b8) to head (61a2f12).
⚠️ Report is 60 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3256      +/-   ##
==========================================
+ Coverage   14.73%   14.74%   +0.01%     
==========================================
  Files         200      200              
  Lines       93077    93027      -50     
==========================================
+ Hits        13712    13715       +3     
+ Misses      78019    77977      -42     
+ Partials     1346     1335      -11     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thaJeztah
thaJeztah marked this pull request as ready for review July 25, 2026 17:20
@thaJeztah

Copy link
Copy Markdown
Member Author

@corhere @dperny @vvoland PTAL 🤗

@corhere corhere left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just embed the interface into the fake structs? Maintaining our own subset interfaces is a lot of ceremony just so tests fail to build rather than panic at runtime when a needed method isn't faked.

// manager/csi/fakes_test.go
type fakeIdentityClient struct {
        csi.IdentityClient
        caps []*csi.PluginCapability
}

Make sure the fake clients satisfies the CSI interface if new methods are
added to it that are unused in SwarmKit's implementation.

Also remove the GetPluginInfo stub method, as it's not used in SwarmKit's
implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah changed the title manager/csi,agent/csi: narrow CSI client interfaces manager/csi: fakeIdentityClient, fakeControllerClient: embed interface Aug 1, 2026
@thaJeztah
thaJeztah requested a review from corhere August 3, 2026 16:47
@thaJeztah

Copy link
Copy Markdown
Member Author

@corhere updated; PTAL

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