@@ -234,15 +234,15 @@ impl ValidatedCluster {
234234
235235 /// Type-safe names for the per-cluster RBAC resources: the ServiceAccount shared by all
236236 /// Pods, its (namespaced) RoleBinding, and the operator-deployed ClusterRole it binds.
237- pub fn rbac_resource_names ( & self ) -> role_utils:: ResourceNames {
237+ pub fn cluster_resource_names ( & self ) -> role_utils:: ResourceNames {
238238 role_utils:: ResourceNames {
239239 cluster_name : self . name . clone ( ) ,
240240 product_name : product_name ( ) ,
241241 }
242242 }
243243
244244 /// Type-safe names for the resources of a given role group.
245- pub ( crate ) fn resource_names (
245+ pub ( crate ) fn role_group_resource_names (
246246 & self ,
247247 role : & TrinoRole ,
248248 role_group_name : & RoleGroupName ,
@@ -263,7 +263,7 @@ impl ValidatedCluster {
263263 ) -> String {
264264 format ! (
265265 "{}-catalog" ,
266- self . resource_names ( role, role_group_name)
266+ self . role_group_resource_names ( role, role_group_name)
267267 . role_group_config_map( )
268268 )
269269 }
@@ -465,3 +465,20 @@ pub(crate) fn validated_cluster() -> ValidatedCluster {
465465
466466 validate:: validate ( & minimal_trino ( ) , & derefs, & operator_env) . expect ( "validate should succeed" )
467467}
468+
469+ #[ cfg( test) ]
470+ mod tests {
471+ use strum:: IntoEnumIterator ;
472+
473+ use super :: ValidatedCluster ;
474+ use crate :: crd:: TrinoRole ;
475+
476+ /// Locks the invariant behind the `expect` in [`ValidatedCluster::role_name`]: every
477+ /// `TrinoRole` variant (present and future) must serialise to a valid `RoleName`.
478+ #[ test]
479+ fn every_trino_role_serialises_to_a_valid_role_name ( ) {
480+ for role in TrinoRole :: iter ( ) {
481+ ValidatedCluster :: role_name ( & role) ;
482+ }
483+ }
484+ }
0 commit comments