Files
cozystack/packages/apps/opensearch/tests/users_test.yaml
T
MatthieuandClaude Opus 4.5 25ff583f34 [apps] Add managed OpenSearch service
Add OpenSearch application with operator and resource definition:
- App chart with multi-version support (v1/v2/v3), TLS, auth, dashboards
- OpenSearch operator wrapper (opster v2.8.0) with sysctl daemonset
- ApplicationDefinition for Cozystack platform integration

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Matthieu <matthieu@hidora.com>
2026-02-16 22:54:41 +01:00

177 lines
3.5 KiB
YAML

suite: users secrets tests
templates:
- templates/users.yaml
tests:
###################
# Basic rendering #
###################
- it: does not render secrets when no users defined
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users: {}
asserts:
- hasDocuments:
count: 0
- it: renders one secret per user
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
user1:
roles:
- readall
user2:
roles:
- all_access
asserts:
- hasDocuments:
count: 2
#####################
# Secret metadata #
#####################
- it: sets correct secret name
release:
name: my-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
myuser:
roles:
- readall
asserts:
- equal:
path: metadata.name
value: my-os-user-myuser
- it: sets opensearch credentials label
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
myuser:
roles:
- readall
asserts:
- equal:
path: metadata.labels["opensearch.opster.io/credentials"]
value: "true"
- it: uses basic-auth secret type
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
myuser:
roles:
- readall
asserts:
- equal:
path: type
value: kubernetes.io/basic-auth
#####################
# Secret data #
#####################
- it: sets username in secret
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
testuser:
roles:
- readall
asserts:
- equal:
path: stringData.username
value: testuser
- it: uses provided password
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
myuser:
password: mysecretpassword
roles:
- readall
asserts:
- equal:
path: stringData.password
value: mysecretpassword
- it: generates password when not provided
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
myuser:
roles:
- readall
asserts:
- matchRegex:
path: stringData.password
pattern: "^[a-zA-Z0-9]{16}$"
- it: sets roles as comma-separated string
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
myuser:
roles:
- readall
- reporting_user
- monitoring_user
asserts:
- equal:
path: stringData.roles
value: "readall,reporting_user,monitoring_user"
- it: defaults to readall role when no roles specified
release:
name: test-os
namespace: tenant-test
set:
_cluster:
cluster-domain: cozy.local
users:
myuser: {}
asserts:
- equal:
path: stringData.roles
value: "readall"