Skip to content

Commit 81ecbf1

Browse files
committed
test: Add CRD roundtrip test data
1 parent f7bc2e2 commit 81ecbf1

2 files changed

Lines changed: 144 additions & 2 deletions

File tree

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

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,71 @@ mod tests {
111111

112112
impl RoundtripTestData for v1alpha1::TrinoCatalogSpec {
113113
fn roundtrip_test_data() -> Vec<Self> {
114-
vec![]
114+
stackable_operator::utils::yaml_from_str_singleton_map(indoc::indoc! {"
115+
- connector:
116+
blackHole: {}
117+
- connector:
118+
deltaLake:
119+
metastore:
120+
configMap: simple-hive
121+
s3:
122+
inline:
123+
host: test-minio
124+
port: 9000
125+
accessStyle: Path
126+
credentials:
127+
secretClass: minio-credentials
128+
- connector:
129+
generic:
130+
connectorName: postgresql
131+
properties: # optional
132+
connection-url:
133+
value: jdbc:postgresql://example.net:5432/database
134+
connection-user:
135+
valueFromSecret:
136+
name: my-postgresql-credentials-secret
137+
key: user
138+
connection-password:
139+
valueFromSecret:
140+
name: my-postgresql-credentials-secret
141+
key: password
142+
- connector:
143+
googleSheet:
144+
credentialsSecret: gsheet-credentials
145+
metadataSheetId: 1dT4dRWo9tAKBk5GdH-a54dcizuoxOTn98X8igZcnYr8
146+
cache: # optional
147+
sheetsDataMaxCacheSize: 1000
148+
sheetsDataExpireAfterWrite: 5m
149+
- connector:
150+
hive:
151+
metastore:
152+
configMap: simple-hive
153+
s3:
154+
inline:
155+
host: test-minio
156+
port: 9000
157+
accessStyle: Path
158+
credentials:
159+
secretClass: minio-credentials
160+
configOverrides:
161+
hive.metastore.username: trino
162+
- connector:
163+
iceberg:
164+
metastore:
165+
configMap: simple-hive
166+
s3:
167+
inline:
168+
host: test-minio
169+
port: 9000
170+
accessStyle: Path
171+
credentials:
172+
secretClass: minio-credentials
173+
- connector:
174+
tpcds: {}
175+
- connector:
176+
tpch: {}
177+
"})
178+
.expect("Failed to parse TrinoCatalogSpec YAML")
115179
}
116180
}
117181
}

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

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,85 @@ mod tests {
13331333

13341334
impl RoundtripTestData for v1alpha1::TrinoClusterSpec {
13351335
fn roundtrip_test_data() -> Vec<Self> {
1336-
vec![]
1336+
stackable_operator::utils::yaml_from_str_singleton_map(indoc::indoc! {r#"
1337+
- image:
1338+
productVersion: "42"
1339+
pullPolicy: IfNotPresent
1340+
clusterOperation:
1341+
stopped: false
1342+
reconciliationPaused: false
1343+
clusterConfig:
1344+
catalogLabelSelector:
1345+
matchLabels:
1346+
trino: trino
1347+
authentication:
1348+
- authenticationClass: oidc
1349+
oidc:
1350+
clientCredentialsSecret: oidc-secret
1351+
- authenticationClass: password
1352+
- authenticationClass: password-other
1353+
- authenticationClass: ldap
1354+
- authenticationClass: ldap-other
1355+
authorization:
1356+
opa:
1357+
configMapName: opa
1358+
package: trino
1359+
tls:
1360+
serverSecretClass: my-tls
1361+
internalSecretClass: null
1362+
clientProtocol:
1363+
spooling:
1364+
location: s3://spooling-bucket/trino/
1365+
filesystem:
1366+
s3:
1367+
connection:
1368+
reference: minio
1369+
faultTolerantExecution:
1370+
task:
1371+
exchangeManager:
1372+
s3:
1373+
baseDirectories:
1374+
- s3://exchange-bucket/
1375+
connection:
1376+
reference: minio
1377+
vectorAggregatorConfigMapName: vector-aggregator-discovery
1378+
coordinators:
1379+
config:
1380+
logging:
1381+
enableVectorAgent: true
1382+
roleConfig:
1383+
listenerClass: external-unstable
1384+
envOverrides:
1385+
COMMON_VAR: role-value
1386+
ROLE_VAR: role-value
1387+
roleGroups:
1388+
default:
1389+
replicas: 1
1390+
envOverrides:
1391+
COMMON_VAR: group-value
1392+
GROUP_VAR: group-value
1393+
workers:
1394+
config:
1395+
resources:
1396+
cpu:
1397+
min: 300m
1398+
max: 600m
1399+
memory:
1400+
limit: 3Gi
1401+
gracefulShutdownTimeout: 5s
1402+
logging:
1403+
enableVectorAgent: true
1404+
envOverrides:
1405+
COMMON_VAR: role-value
1406+
ROLE_VAR: role-value
1407+
roleGroups:
1408+
default:
1409+
replicas: 1
1410+
envOverrides:
1411+
COMMON_VAR: group-value
1412+
GROUP_VAR: group-value
1413+
"#})
1414+
.expect("Failed to parse TrinoClusterSpec YAML")
13371415
}
13381416
}
13391417
}

0 commit comments

Comments
 (0)