<p>While I'm reading how to test on k8s with the fake client on this <a href="https://itnext.io/testing-kubernetes-go-applications-f1f87502b6ef" rel="nofollow noreferrer">link</a>, I noticed this function, which, IIUC, assigns a faked server version to the faked k8s cluster.</p>
<pre><code>k8s.clientset.Discovery().(*discoveryfake.FakeDiscovery).FakedServerVersion = &amp;version.Info{
                    Major: expectedMajor,
                    Minor: expectedMinor,
            }
</code></pre>
<p>I'm trying to understand what this <code>*discoveryfake.FakeDiscovery</code> code means.
<code>k8s.clientset.Discovery()</code> returns <code>DiscoveryInterface</code> (<a href="https://pkg.go.dev/k8s.io/client-go@v0.26.2/discovery#DiscoveryInterface" rel="nofollow noreferrer">defined here</a>), but I cannot find <code>*discoveryfake</code> field.</p>
<p>What does <code>Discovery().(*discoveryfake.FakeDiscovery)</code> mean?</p>

Mike
<p>It's a <a href="https://go.dev/tour/methods/15" rel="nofollow noreferrer">type assertion</a>, as @peter suggested in the comment.</p>
