Skip to content

Commit e3151e3

Browse files
committed
Use serde_yaml for entire_role
1 parent c816bab commit e3151e3

File tree

1 file changed

+19
-43
lines changed

1 file changed

+19
-43
lines changed

crates/stackable-operator/src/role_utils.rs

Lines changed: 19 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -504,55 +504,31 @@ mod tests {
504504
.into(),
505505
);
506506

507-
// Let's say we want to set some additional HTTP Proxy and IPv4 settings
508-
// And we don't like the garbage collector for some reason...
509-
let role: JavaCommonConfig = serde_yaml::from_str(
510-
r#"
507+
let entire_role: Role<(), GenericRoleConfig, JavaCommonConfig> =
508+
serde_yaml::from_str("
509+
# Let's say we want to set some additional HTTP Proxy and IPv4 settings
510+
# And we don't like the garbage collector for some reason...
511511
jvmArgumentOverrides:
512512
remove:
513513
- -XX:+UseG1GC
514-
add:
514+
add: # Add some networking arguments
515515
- -Dhttps.proxyHost=proxy.my.corp
516516
- -Dhttps.proxyPort=8080
517517
- -Djava.net.preferIPv4Stack=true
518-
"#,
519-
)
520-
.unwrap();
521-
522-
// For the roleGroup, let's say we need a different memory config.
523-
// For that to work we first remove the flags generated by the operator and add our own.
524-
// Also we override the proxy port to test that the roleGroup config takes precedence over the role config.
525-
let role_group: JavaCommonConfig = serde_yaml::from_str(
526-
r#"
527-
jvmArgumentOverrides:
528-
removeRegex:
529-
- # We need more memory!
530-
- -Xmx.*
531-
- -Dhttps.proxyPort=.*
532-
add:
533-
- -Xmx40000m
534-
- -Dhttps.proxyPort=1234
535-
"#,
536-
)
537-
.unwrap();
538-
539-
let entire_role: Role<(), GenericRoleConfig, JavaCommonConfig> = Role {
540-
config: CommonConfiguration {
541-
product_specific_common_config: role,
542-
..Default::default()
543-
},
544-
role_groups: HashMap::from([(
545-
"default".to_owned(),
546-
RoleGroup {
547-
config: CommonConfiguration {
548-
product_specific_common_config: role_group,
549-
..Default::default()
550-
},
551-
replicas: Some(42),
552-
},
553-
)]),
554-
..Default::default()
555-
};
518+
roleGroups:
519+
default:
520+
# For the roleGroup, let's say we need a different memory config.
521+
# For that to work we first remove the flags generated by the operator and add our own.
522+
# Also we override the proxy port to test that the roleGroup config takes precedence over the role config.
523+
jvmArgumentOverrides:
524+
removeRegex:
525+
- -Xmx.*
526+
- -Dhttps.proxyPort=.*
527+
add:
528+
- -Xmx40000m
529+
- -Dhttps.proxyPort=1234
530+
")
531+
.expect("Failed to parse role");
556532

557533
let merged_jvm_argument_overrides = entire_role
558534
.get_merged_jvm_argument_overrides("default", &operator_generated)

0 commit comments

Comments
 (0)