Created
February 28, 2019 16:42
-
-
Save aslakknutsen/e1d9c807bd38a9f1bde26b7a0f1e44cf to your computer and use it in GitHub Desktop.
ginkgo
This file contains 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