mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 20:23:39 +09:00
Align MongoDB configuration with postgres and mysql patterns: - Add separate `databases` section with `roles.admin` and `roles.readonly` - Simplify `users` to only contain optional password field - All users now authenticate via `admin` database (MongoDB best practice) - Admin role maps to readWrite + dbAdmin permissions - Readonly role maps to read permission Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
79 lines
1.6 KiB
YAML
79 lines
1.6 KiB
YAML
suite: user secrets tests
|
|
|
|
templates:
|
|
- templates/user-secrets.yaml
|
|
|
|
tests:
|
|
# No users configured
|
|
- it: does not render when no users defined
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
users: {}
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 0
|
|
|
|
# Single user
|
|
- it: creates secret for single user
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
users:
|
|
myuser: {}
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 1
|
|
- isKind:
|
|
of: Secret
|
|
- equal:
|
|
path: metadata.name
|
|
value: test-mongodb-user-myuser
|
|
- equal:
|
|
path: type
|
|
value: Opaque
|
|
- exists:
|
|
path: stringData.password
|
|
|
|
# Multiple users
|
|
- it: creates separate secrets for multiple users
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
users:
|
|
user1: {}
|
|
user2: {}
|
|
asserts:
|
|
- hasDocuments:
|
|
count: 2
|
|
|
|
# User with explicit password
|
|
- it: uses explicit password when provided
|
|
release:
|
|
name: test-mongodb
|
|
namespace: tenant-test
|
|
set:
|
|
users:
|
|
myuser:
|
|
password: "mysecretpassword"
|
|
asserts:
|
|
- equal:
|
|
path: stringData.password
|
|
value: "mysecretpassword"
|
|
|
|
# Secret naming convention
|
|
- it: follows naming convention release-user-username
|
|
release:
|
|
name: prod-db
|
|
namespace: tenant-prod
|
|
set:
|
|
users:
|
|
admin: {}
|
|
asserts:
|
|
- equal:
|
|
path: metadata.name
|
|
value: prod-db-user-admin
|