Skip to content

Commit 89df3cc

Browse files
committed
Minor
Signed-off-by: Halvdan Hoem Grelland <[email protected]>
1 parent 76a32a4 commit 89df3cc

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pkg/gator/reader/read_resources.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ func ReadExpansions(f fs.FS, path string) ([]*unstructured.Unstructured, error)
261261
for _, obj := range objs {
262262
gvk := obj.GroupVersionKind()
263263
if gvk.Group != "expansion.gatekeeper.sh" || gvk.Kind != "ExpansionTemplate" {
264-
return nil, gator.ErrNotAnExpansion
264+
return nil, fmt.Errorf("%w: %q", gator.ErrNotAnExpansion, path)
265265
}
266266
}
267267

pkg/gator/verify/runner.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ import (
1212
"github.com/open-policy-agent/frameworks/constraint/pkg/client/reviews"
1313
"github.com/open-policy-agent/frameworks/constraint/pkg/types"
1414

15+
admissionv1 "k8s.io/api/admission/v1"
16+
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
17+
"k8s.io/apimachinery/pkg/runtime"
18+
"k8s.io/utils/ptr"
19+
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
20+
1521
"github.com/open-policy-agent/gatekeeper/v3/apis"
1622
"github.com/open-policy-agent/gatekeeper/v3/pkg/expansion"
1723
"github.com/open-policy-agent/gatekeeper/v3/pkg/gator"
@@ -20,11 +26,6 @@ import (
2026
mutationtypes "github.com/open-policy-agent/gatekeeper/v3/pkg/mutation/types"
2127
"github.com/open-policy-agent/gatekeeper/v3/pkg/target"
2228
"github.com/open-policy-agent/gatekeeper/v3/pkg/util"
23-
admissionv1 "k8s.io/api/admission/v1"
24-
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
25-
"k8s.io/apimachinery/pkg/runtime"
26-
"k8s.io/utils/ptr"
27-
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2829
)
2930

3031
// Runner defines logic independent of how tests are run and the results are
@@ -239,12 +240,12 @@ func (r *Runner) makeTestExpander(suiteDir string, t *Test) (*expand.Expander, e
239240
return nil, nil
240241
}
241242

242-
expansionsTemplates, err := reader.ReadExpansions(r.filesystem, path.Join(suiteDir, expansionPath))
243+
expansionTemplates, err := reader.ReadExpansions(r.filesystem, path.Join(suiteDir, expansionPath))
243244
if err != nil {
244245
return nil, err
245246
}
246247

247-
er, err := expand.NewExpander(expansionsTemplates)
248+
er, err := expand.NewExpander(expansionTemplates)
248249
return er, err
249250
}
250251

0 commit comments

Comments
 (0)