Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ginkgo
var objects []runtime.Object
var ctx model.SessionContext
BeforeEach(func() {
ctx = model.SessionContext{
Context: context.TODO(),
Name: "test",
Namespace: "test",
Log: logf.Log.WithName("test"),
Client: fake.NewFakeClient(objects...),
}
})
Context("locators", func() {
It("should report false on not found", func() {
//testClient.Setup([]T{T{Error: errors.NewNotFound(schema.GroupResource{Group: "core", Resource: "Deployment"}, "test")}})
ref := model.Ref{Name: "test-ref"}
Expect(k8.DeploymentLocator(ctx, &ref)).To(Equal(false))
})
It("should report false on other found", func() {
//testClient.Setup([]T{T{Error: errors.NewServerTimeout(schema.GroupResource{Group: "core", Resource: "Deployment"}, "GET", 10)}})
ref := model.Ref{Name: "test-ref"}
Expect(k8.DeploymentLocator(ctx, &ref)).To(Equal(false))
})
It("should report true on found", func() {
//testClient.Setup([]T{T{Obj: &appsv1.Deployment{}}})
ref := model.Ref{Name: "test-ref"}
Expect(k8.DeploymentLocator(ctx, &ref)).To(Equal(true))
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment