From 6d3171cf2dfd0efb43740d41e8e97d3dba5d53a3 Mon Sep 17 00:00:00 2001 From: Anushka Mittal Date: Tue, 27 Aug 2024 19:42:00 +0530 Subject: [PATCH] NDEV-19864: add correct packages Signed-off-by: Anushka Mittal --- pkg/engine/context/context.go | 12 +++++++----- pkg/engine/context/context_test.go | 3 ++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/engine/context/context.go b/pkg/engine/context/context.go index 8ee1741dcb3c..761fb70bf421 100644 --- a/pkg/engine/context/context.go +++ b/pkg/engine/context/context.go @@ -1,6 +1,7 @@ package context import ( + cont "context" "encoding/csv" "fmt" "regexp" @@ -13,6 +14,7 @@ import ( "github.com/kyverno/kyverno/pkg/engine/jmespath" "github.com/kyverno/kyverno/pkg/engine/jsonutils" "github.com/kyverno/kyverno/pkg/logging" + "github.com/kyverno/kyverno/pkg/toggle" apiutils "github.com/kyverno/kyverno/pkg/utils/api" admissionv1 "k8s.io/api/admission/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" @@ -395,12 +397,12 @@ func (ctx *context) GenerateCustomImageInfo(resource *unstructured.Unstructured, } func (ctx *context) ImageInfo() map[string]map[string]apiutils.ImageInfo { - // force load of image info from deferred loader - if len(ctx.images) == 0 { - if err := ctx.loadDeferred("images"); err != nil { - return map[string]map[string]apiutils.ImageInfo{} - } + // force load of image info from deferred loader + if len(ctx.images) == 0 { + if err := ctx.loadDeferred("images"); err != nil { + return map[string]map[string]apiutils.ImageInfo{} } + } return ctx.images } diff --git a/pkg/engine/context/context_test.go b/pkg/engine/context/context_test.go index 5920efbab9fa..6a32ecb4c21d 100644 --- a/pkg/engine/context/context_test.go +++ b/pkg/engine/context/context_test.go @@ -7,8 +7,9 @@ import ( urkyverno "github.com/kyverno/kyverno/api/kyverno/v1beta1" "github.com/kyverno/kyverno/pkg/config" "github.com/kyverno/kyverno/pkg/engine/jmespath" - authenticationv1 "k8s.io/api/authentication/v1" kubeutils "github.com/kyverno/kyverno/pkg/utils/kube" + "github.com/stretchr/testify/assert" + authenticationv1 "k8s.io/api/authentication/v1" ) var (