Mike
Mike

Reputation: 1857

Where is the discoveryfake defined in k8s discovery interface?

While I'm reading how to test on k8s with the fake client on this link, I noticed this function, which, IIUC, assigns a faked server version to the faked k8s cluster.

k8s.clientset.Discovery().(*discoveryfake.FakeDiscovery).FakedServerVersion = &version.Info{
                    Major: expectedMajor,
                    Minor: expectedMinor,
            }

I'm trying to understand what this *discoveryfake.FakeDiscovery code means. k8s.clientset.Discovery() returns DiscoveryInterface (defined here), but I cannot find *discoveryfake field.

What does Discovery().(*discoveryfake.FakeDiscovery) mean?

Upvotes: 2

Views: 168

Answers (1)

Mike
Mike

Reputation: 1857

It's a type assertion, as @peter suggested in the comment.

Upvotes: 1

Related Questions