Skip to content

Commit 62548be

Browse files
Extend node_config unit test
1 parent 1e119a0 commit 62548be

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

rust/operator-binary/src/controller/build/node_config.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ const CONFIG_OPTION_NODE_ROLES: &str = "node.roles";
7171
/// Type: string
7272
const CONFIG_OPTION_PATH_LOGS: &str = "path.logs";
7373

74-
/// If this is set to true OpenSearch Security will automatically initialize the configuration index
75-
/// with the files in the config directory if the index does not exist.
74+
/// If this is set to true, the OpenSearch security plugin will automatically initialize the
75+
/// configuration index with the files in the config directory if the index does not exist.
7676
/// Type: boolean
7777
const CONFIG_OPTION_PLUGINS_SECURITY_ALLOW_DEFAULT_INIT_SECURITYINDEX: &str =
7878
"plugins.security.allow_default_init_securityindex";
@@ -81,7 +81,7 @@ const CONFIG_OPTION_PLUGINS_SECURITY_ALLOW_DEFAULT_INIT_SECURITYINDEX: &str =
8181
/// Type: (comma-separated) list of strings
8282
const CONFIG_OPTION_PLUGINS_SECURITY_AUTHCZ_ADMIN_DN: &str = "plugins.security.authcz.admin_dn";
8383

84-
/// Disables the security plugin
84+
/// Whether to disable the security plugin
8585
/// Type: boolean
8686
const CONFIG_OPTION_PLUGINS_SECURITY_DISABLED: &str = "plugins.security.disabled";
8787

@@ -536,7 +536,7 @@ mod tests {
536536
product_logging::framework::ValidatedContainerLogConfigChoice,
537537
role_utils::GenericProductSpecificCommonConfig,
538538
types::{
539-
kubernetes::{ListenerClassName, NamespaceName},
539+
kubernetes::{ConfigMapKey, ConfigMapName, ListenerClassName, NamespaceName},
540540
operator::{ClusterName, ProductVersion, RoleGroupName},
541541
},
542542
},
@@ -627,8 +627,21 @@ mod tests {
627627
)]
628628
.into(),
629629
Some(ValidatedSecurity {
630-
managing_role_group: None,
631-
config: v1alpha1::SecurityConfig::default(),
630+
managing_role_group: Some(RoleGroupName::from_str_unsafe("default")),
631+
config: v1alpha1::SecurityConfig {
632+
config: v1alpha1::SecurityConfigFileType {
633+
managed_by: v1alpha1::SecurityConfigFileTypeManagedBy::Operator,
634+
content: v1alpha1::SecurityConfigFileTypeContent::ValueFrom(
635+
v1alpha1::SecurityConfigFileTypeContentValueFrom::ConfigMapKeyRef(
636+
v1alpha1::ConfigMapKeyRef {
637+
name: ConfigMapName::from_str_unsafe("security-config"),
638+
key: ConfigMapKey::from_str_unsafe("config.yml"),
639+
},
640+
),
641+
),
642+
},
643+
..v1alpha1::SecurityConfig::default()
644+
},
632645
tls: v1alpha1::OpenSearchTls::default(),
633646
}),
634647
vec![],
@@ -659,7 +672,8 @@ mod tests {
659672
"network.host: \"0.0.0.0\"\n",
660673
"node.attr.role-group: \"data\"\n",
661674
"path.logs: \"/stackable/log/opensearch\"\n",
662-
"plugins.security.allow_default_init_securityindex: true\n",
675+
"plugins.security.allow_default_init_securityindex: false\n",
676+
"plugins.security.authcz.admin_dn: \"CN=update-security-config.0b1e30e6-326e-4c1a-868d-ad6598b49e8b\"\n",
663677
"plugins.security.disabled: false\n",
664678
"plugins.security.nodes_dn: [\"CN=generated certificate for pod\"]\n",
665679
"plugins.security.ssl.http.enabled: true\n",

0 commit comments

Comments
 (0)