Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
  • Loading branch information
Pavel Okhlopkov committed Nov 13, 2024
1 parent 1f7732e commit b286e2c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ func Test(t *testing.T) {
}

var _ = Describe("Binding 'kubernetes' with kind 'Pod' should emit KubeEvent objects", func() {
var KubeEventsManager kube_events_manager.KubeEventsManager
var KubeEventsManager kubeeventsmanager.KubeEventsManager

BeforeEach(func() {
KubeEventsManager = kube_events_manager.NewKubeEventsManager(context.Background(), KubeClient, log.NewNop())
KubeEventsManager = kubeeventsmanager.NewKubeEventsManager(context.Background(), KubeClient, log.NewNop())
})

Context("with configVersion: v1", func() {
var monitorConfig *kube_events_manager.MonitorConfig
var monitorConfig *kubeeventsmanager.MonitorConfig

BeforeEach(func() {
monitorConfig = &kube_events_manager.MonitorConfig{
monitorConfig = &kubeeventsmanager.MonitorConfig{
Kind: "Pod",
ApiVersion: "v1",
KeepFullObjectsInMemory: true,
Expand Down
26 changes: 13 additions & 13 deletions test/integration/kubeclient/object_patch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var _ = Describe("Kubernetes API object patching", func() {
})

It("should fail to Create() an object if it already exists", func() {
err := ObjectPatcher.ExecuteOperation(object_patch.NewCreateOperation(unstructuredCM))
err := ObjectPatcher.ExecuteOperation(objectpatch.NewCreateOperation(unstructuredCM))
Expect(err).To(Not(Succeed()))
})

Expand All @@ -79,7 +79,7 @@ var _ = Describe("Kubernetes API object patching", func() {
unstructuredNewTestCM, err := generateUnstructured(newTestCM)
Expect(err).To(Succeed())

err = ObjectPatcher.ExecuteOperation(object_patch.NewCreateOperation(unstructuredNewTestCM, object_patch.UpdateIfExists()))
err = ObjectPatcher.ExecuteOperation(objectpatch.NewCreateOperation(unstructuredNewTestCM, objectpatch.UpdateIfExists()))
Expect(err).To(Succeed())

cm, err := KubeClient.CoreV1().ConfigMaps(testCM.Namespace).Get(context.TODO(), newTestCM.Name, metav1.GetOptions{})
Expand All @@ -94,7 +94,7 @@ var _ = Describe("Kubernetes API object patching", func() {
unstructuredSeparateTestCM, err := generateUnstructured(separateTestCM)
Expect(err).To(Succeed())

err = ObjectPatcher.ExecuteOperation(object_patch.NewCreateOperation(unstructuredSeparateTestCM, object_patch.UpdateIfExists()))
err = ObjectPatcher.ExecuteOperation(objectpatch.NewCreateOperation(unstructuredSeparateTestCM, objectpatch.UpdateIfExists()))
Expect(err).To(Succeed())

_, err = KubeClient.CoreV1().ConfigMaps(testCM.Namespace).Get(context.TODO(), separateTestCM.Name, metav1.GetOptions{})
Expand All @@ -118,17 +118,17 @@ var _ = Describe("Kubernetes API object patching", func() {
})

It("should successfully delete an object", func() {
err := ObjectPatcher.ExecuteOperation(object_patch.NewDeleteOperation(
err := ObjectPatcher.ExecuteOperation(objectpatch.NewDeleteOperation(
testCM.APIVersion, testCM.Kind, testCM.Namespace, testCM.Name,
object_patch.InBackground()))
objectpatch.InBackground()))
Expect(err).Should(Succeed())

_, err = KubeClient.CoreV1().ConfigMaps(testCM.Namespace).Get(context.TODO(), testCM.Name, metav1.GetOptions{})
Expect(errors.IsNotFound(err)).To(BeTrue())
})

It("should successfully delete an object if it doesn't exist", func() {
err := ObjectPatcher.ExecuteOperation(object_patch.NewDeleteOperation(testCM.APIVersion, testCM.Kind, testCM.Namespace, testCM.Name))
err := ObjectPatcher.ExecuteOperation(objectpatch.NewDeleteOperation(testCM.APIVersion, testCM.Kind, testCM.Namespace, testCM.Name))
Expect(err).Should(Succeed())
})
})
Expand All @@ -149,8 +149,8 @@ var _ = Describe("Kubernetes API object patching", func() {
})

It("should successfully JQPatch an object", func() {
err := ObjectPatcher.ExecuteOperation(object_patch.NewFromOperationSpec(object_patch.OperationSpec{
Operation: object_patch.JQPatch,
err := ObjectPatcher.ExecuteOperation(objectpatch.NewFromOperationSpec(objectpatch.OperationSpec{
Operation: objectpatch.JQPatch,
ApiVersion: testCM.APIVersion,
Kind: testCM.Kind,
Namespace: testCM.Namespace,
Expand All @@ -176,7 +176,7 @@ data:
mergePatchJson, err := json.Marshal(mergePatch)
Expect(err).To(Succeed())

err = ObjectPatcher.ExecuteOperation(object_patch.NewMergePatchOperation(mergePatchJson, testCM.APIVersion, testCM.Kind, testCM.Namespace, testCM.Name))
err = ObjectPatcher.ExecuteOperation(objectpatch.NewMergePatchOperation(mergePatchJson, testCM.APIVersion, testCM.Kind, testCM.Namespace, testCM.Name))
Expect(err).To(Succeed())

existingCM, err := KubeClient.CoreV1().ConfigMaps(testCM.Namespace).Get(context.TODO(), testCM.Name, metav1.GetOptions{})
Expand All @@ -185,7 +185,7 @@ data:
})

It("should successfully JSONPatch an object", func() {
err := ObjectPatcher.ExecuteOperation(object_patch.NewJSONPatchOperation(
err := ObjectPatcher.ExecuteOperation(objectpatch.NewJSONPatchOperation(
[]byte(`[{ "op": "replace", "path": "/data/firstField", "value": "jsonPatched"}]`),
testCM.APIVersion, testCM.Kind, testCM.Namespace, testCM.Name))
Expect(err).To(Succeed())
Expand All @@ -205,7 +205,7 @@ func ensureNamespace(name string) error {
panic(err)
}

return ObjectPatcher.ExecuteOperation(object_patch.NewCreateOperation(unstructuredNS, object_patch.UpdateIfExists()))
return ObjectPatcher.ExecuteOperation(objectpatch.NewCreateOperation(unstructuredNS, objectpatch.UpdateIfExists()))
}

func ensureTestObject(_ string, obj interface{}) error {
Expand All @@ -214,11 +214,11 @@ func ensureTestObject(_ string, obj interface{}) error {
panic(err)
}

return ObjectPatcher.ExecuteOperation(object_patch.NewCreateOperation(unstructuredObj, object_patch.UpdateIfExists()))
return ObjectPatcher.ExecuteOperation(objectpatch.NewCreateOperation(unstructuredObj, objectpatch.UpdateIfExists()))
}

func removeNamespace(name string) error {
return ObjectPatcher.ExecuteOperation(object_patch.NewDeleteOperation("", "Namespace", "", name))
return ObjectPatcher.ExecuteOperation(objectpatch.NewDeleteOperation("", "Namespace", "", name))
}

func generateUnstructured(obj interface{}) (*unstructured.Unstructured, error) {
Expand Down

0 comments on commit b286e2c

Please sign in to comment.