Created
February 28, 2019 16:42
-
-
Save aslakknutsen/f4a7dcd202c7b15f009034d934cd73b7 to your computer and use it in GitHub Desktop.
ginkgo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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