Skip to content

Commit 1916ae1

Browse files
committed
test: Add some roundtrip test data
1 parent df45628 commit 1916ae1

4 files changed

Lines changed: 137 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git",
1515
built = { version = "0.8.0", features = ["chrono", "git2"] }
1616
clap = "4.5"
1717
futures = { version = "0.3", features = ["compat"] }
18+
indoc = "2.0"
1819
json-patch = { version = "4.2", features = ["schemars"] }
1920
pretty_assertions = "1.4"
2021
regex = "1.11"

rust/operator-binary/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ uuid.workspace = true
2929
built.workspace = true
3030

3131
[dev-dependencies]
32+
indoc.workspace = true
3233
pretty_assertions.workspace = true
3334
rstest.workspace = true

rust/operator-binary/src/crd/mod.rs

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,140 @@ mod tests {
916916

917917
impl RoundtripTestData for v1alpha1::OpenSearchClusterSpec {
918918
fn roundtrip_test_data() -> Vec<Self> {
919-
vec![]
919+
stackable_operator::utils::yaml_from_str_singleton_map(indoc::indoc! {r#"
920+
- image:
921+
productVersion: 3.4.0
922+
pullPolicy: IfNotPresent
923+
clusterOperation:
924+
reconciliationPaused: false
925+
stopped: false
926+
clusterConfig:
927+
keystore:
928+
- key: s3.client.default.access_key
929+
secretKeyRef:
930+
name: s3-credentials
931+
key: ACCESS_KEY
932+
- key: s3.client.default.secret_key
933+
secretKeyRef:
934+
name: s3-credentials
935+
key: SECRET_KEY
936+
security:
937+
enabled: true
938+
managingRoleGroup: security-coord
939+
settings:
940+
config:
941+
managedBy: operator
942+
content:
943+
value:
944+
_meta:
945+
type: config
946+
config_version: 2
947+
config:
948+
dynamic:
949+
authc:
950+
basic_internal_auth_domain:
951+
description: Authenticate via HTTP Basic against internal users database
952+
http_enabled: true
953+
transport_enabled: true
954+
order: 1
955+
http_authenticator:
956+
type: basic
957+
challenge: true
958+
authentication_backend:
959+
type: intern
960+
authz: {}
961+
internalUsers:
962+
managedBy: API
963+
content:
964+
valueFrom:
965+
secretKeyRef:
966+
name: opensearch-security-config
967+
key: internal_users.yml
968+
roles:
969+
managedBy: API
970+
content:
971+
valueFrom:
972+
configMapKeyRef:
973+
name: opensearch-security-config
974+
key: roles.yml
975+
rolesMapping:
976+
managedBy: API
977+
content:
978+
value:
979+
_meta:
980+
type: rolesmapping
981+
config_version: 2
982+
all_access:
983+
reserved: false
984+
backend_roles:
985+
- admin
986+
tls:
987+
serverSecretClass: tls
988+
internalSecretClass: tls
989+
vectorAggregatorConfigMapName: vector-aggregator-discovery
990+
nodes:
991+
config:
992+
logging:
993+
enableVectorAgent: true
994+
gracefulShutdownTimeout: 2m
995+
requestedSecretLifetime: 1d
996+
envOverrides:
997+
DISABLE_INSTALL_DEMO_CONFIG: "true"
998+
OPENSEARCH_HOME: /stackable/opensearch
999+
configOverrides:
1000+
opensearch.yml:
1001+
jsonMergePatch:
1002+
node.store.allow_mmap: false
1003+
cluster.routing.allocation.disk.threshold_enabled: false
1004+
roleConfig:
1005+
discoveryServiceListenerClass: external-unstable
1006+
roleGroups:
1007+
cluster-manager:
1008+
config:
1009+
discoveryServiceExposed: true
1010+
nodeRoles:
1011+
- cluster_manager
1012+
resources:
1013+
storage:
1014+
data:
1015+
capacity: 100Mi
1016+
replicas: 3
1017+
data:
1018+
config:
1019+
discoveryServiceExposed: false
1020+
nodeRoles:
1021+
- ingest
1022+
- data
1023+
- remote_cluster_client
1024+
listenerClass: cluster-internal
1025+
resources:
1026+
storage:
1027+
data:
1028+
capacity: 2Gi
1029+
configOverrides:
1030+
opensearch.yml:
1031+
jsonMergePatch:
1032+
node.attr.zone: eu-central-1a
1033+
envOverrides:
1034+
OPENSEARCH_JAVA_OPTS: -Xms1g -Xmx1g
1035+
replicas: 2
1036+
- image:
1037+
custom: oci.example.com/namespace/opensearch:3.4.0-custom
1038+
productVersion: 3.4.0
1039+
pullPolicy: Always
1040+
pullSecrets:
1041+
- name: registry-credentials
1042+
clusterConfig:
1043+
tls:
1044+
serverSecretClass: null
1045+
security:
1046+
enabled: false
1047+
nodes:
1048+
roleGroups:
1049+
default:
1050+
replicas: 1
1051+
"#})
1052+
.expect("Failed to parse OpenSearchClusterSpec YAML")
9201053
}
9211054
}
9221055
}

0 commit comments

Comments
 (0)