Hi,
I am trying to set-up an integration test using envtest. So far I have been able to add the required CRDs and deploy my own operator yaml file.
My operator adds various objects to the cluster based on the data in the CRD (deployment, service etc).
However when i run my envtest, the deployment cannot be found when i add my resource. I tried extending the timeout and add a long sleep, but none of this worked (see code sample at the bottom of this post)
Do i need to do something to make my operator “work” during my envtest?
tx.,
func (ts *TotoTestSuite) Test_Smoke() {
toto := &acme.Toto{
ObjectMeta: metav1.ObjectMeta{
…
},
Spec: …
}
err := ts.Client.Create(ts.Ctx, toto)
ts.Require().NoError(err)
dep := v1.Deployment{}
timedCtx, cancel := context.WithTimeout(ts.Ctx, 5*time.Second)
defer cancel()
//time.Sleep(4 * time.Minute)
ts.Require().NoError(ts.Client.Get(timedCtx, types.NamespacedName{Name: name(toto), Namespace: "test"}, &dep))
ts.Require().Equal(dep.Name, "foobar")
}
--
You received this message because you are subscribed to the Google Groups "Operator Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to operator-framew...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/operator-framework/cf961c30-11a3-4447-a16b-81e669665839n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/operator-framework/3a4f9dca-7677-4669-949d-6f6ee232ab5fn%40googlegroups.com.