Testing children fetching in Golang operator

14 views
Skip to first unread message

Hannu Kröger

unread,
Nov 26, 2020, 3:04:11 AM11/26/20
to Operator Framework
Hello,

I started to build my own operator in Golang and basics are working fine. I am now looking into building tests using Ginkgo framework and am following examples.

I ran into a problem when I run my operator unit tests and operator is fetching children of my custom resource.

I get an error "unable to list children {"tenant": "default/foo", "error": "field label not supported: .metadata.controller"}".

I tried creating a new manager and setting it up before the test like this. I have SetupWithManager creating indexes:

     Expect(reconciler.SetupWithManager(mgr)).To(Succeed())

This succeeds but doesn't help. I guess I just don't understand something here.

So, my question is: How do I setup the indexes correctly so that I can fetch child resources correctly in unit tests?

BR,
Hannu
Reply all
Reply to author
Forward
0 new messages