MCPcopy Index your code
hub / github.com/coder/coder / TestAllResources

Function TestAllResources

coderd/rbac/object_test.go:180–196  ·  view source on GitHub ↗

TestAllResources ensures that all resources have a unique type name.

(t *testing.T)

Source from the content-addressed store, hash-verified

178
179// TestAllResources ensures that all resources have a unique type name.
180func TestAllResources(t *testing.T) {
181 t.Parallel()
182
183 var typeNames []string
184 resources := rbac.AllResources()
185 for _, r := range resources {
186 if r.RBACObject().Type == "" {
187 t.Errorf("empty type name: %s", r.RBACObject().Type)
188 continue
189 }
190 if slice.Contains(typeNames, r.RBACObject().Type) {
191 t.Errorf("duplicate type name: %s", r.RBACObject().Type)
192 continue
193 }
194 typeNames = append(typeNames, r.RBACObject().Type)
195 }
196}

Callers

nothing calls this directly

Calls 4

AllResourcesFunction · 0.92
ContainsFunction · 0.92
RBACObjectMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected