MCPcopy
hub / github.com/open-policy-agent/gatekeeper / TestRun_NoTemplates

Function TestRun_NoTemplates

pkg/gator/bench/bench_test.go:23–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestRun_NoTemplates(t *testing.T) {
24 // Create a temp file with just an object (no template)
25 tmpDir := t.TempDir()
26 objFile := filepath.Join(tmpDir, "object.yaml")
27 err := os.WriteFile(objFile, []byte(`
28apiVersion: v1
29kind: Pod
30metadata:
31 name: test-pod
32`), 0o600)
33 if err != nil {
34 t.Fatalf("failed to write test file: %v", err)
35 }
36
37 _, err = Run(&Opts{
38 Filenames: []string{tmpDir},
39 Iterations: 1,
40 Engine: EngineRego,
41 })
42 if err == nil {
43 t.Error("expected error for missing templates")
44 }
45}
46
47func TestRun_Integration(t *testing.T) {
48 // Create temp files with a template, constraint, and object

Callers

nothing calls this directly

Calls 2

RunFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…