Add MongoDB managed service based on Percona Operator for MongoDB with: - Replica set mode (default) and sharded cluster mode - Configurable replicas, storage, and resource presets - Custom users with role-based access control - S3-compatible backup with PITR support - Bootstrap/restore from backup - External access support - WorkloadMonitor integration for dashboard - Comprehensive helm-unittest test coverage (91 tests) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
132 lines
3 KiB
YAML
132 lines
3 KiB
YAML
suite: credentials tests
|
|
|
|
templates:
|
|
- templates/credentials.yaml
|
|
|
|
tests:
|
|
# Basic rendering
|
|
- it: always renders a Secret
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster:
|
|
cluster-domain: cozy.local
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- isKind:
|
|
of: Secret
|
|
- equal:
|
|
path: metadata.name
|
|
value: test-mongodb-credentials
|
|
- equal:
|
|
path: type
|
|
value: Opaque
|
|
|
|
# Username is always databaseAdmin
|
|
- it: sets username to databaseAdmin
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster:
|
|
cluster-domain: cozy.local
|
|
asserts:
|
|
- equal:
|
|
path: stringData.username
|
|
value: databaseAdmin
|
|
|
|
# Port is always 27017
|
|
- it: sets port to 27017
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster:
|
|
cluster-domain: cozy.local
|
|
asserts:
|
|
- equal:
|
|
path: stringData.port
|
|
value: "27017"
|
|
|
|
# Host for replica set mode
|
|
- it: uses rs0 service for replica set mode
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster:
|
|
cluster-domain: cozy.local
|
|
sharding: false
|
|
asserts:
|
|
- equal:
|
|
path: stringData.host
|
|
value: test-mongodb-rs0.tenant-test.svc.cozy.local
|
|
|
|
# Host for sharded mode
|
|
- it: uses mongos service for sharded mode
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster:
|
|
cluster-domain: cozy.local
|
|
sharding: true
|
|
asserts:
|
|
- equal:
|
|
path: stringData.host
|
|
value: test-mongodb-mongos.tenant-test.svc.cozy.local
|
|
|
|
# Custom cluster domain
|
|
- it: uses custom cluster domain
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster:
|
|
cluster-domain: custom.domain
|
|
sharding: false
|
|
asserts:
|
|
- equal:
|
|
path: stringData.host
|
|
value: test-mongodb-rs0.tenant-test.svc.custom.domain
|
|
|
|
# Default cluster domain when not set
|
|
- it: defaults to cozy.local when cluster domain not set
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster: {}
|
|
sharding: false
|
|
asserts:
|
|
- equal:
|
|
path: stringData.host
|
|
value: test-mongodb-rs0.tenant-test.svc.cozy.local
|
|
|
|
# Password empty without operator secret (lookup returns nil in tests)
|
|
- it: has empty password on first install
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster:
|
|
cluster-domain: cozy.local
|
|
asserts:
|
|
- equal:
|
|
path: stringData.password
|
|
value: ""
|
|
|
|
# URI empty without password
|
|
- it: has empty uri when password not available
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
_cluster:
|
|
cluster-domain: cozy.local
|
|
asserts:
|
|
- equal:
|
|
path: stringData.uri
|
|
value: ""
|