Skip to content

Commit a0c5269

Browse files
test: Test snapshots in S3 (#49)
* test: Test creating snapshots in S3 * test: Use ListenerClass external-unstable; Check SSL hostname in opensearchpy * test: Remove resolved TODO comment
1 parent 411976a commit a0c5269

20 files changed

Lines changed: 575 additions & 10 deletions

tests/templates/kuttl/ldap/30-test-opensearch.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ spec:
2222
# required for pip install
2323
- name: HOME
2424
value: /stackable
25+
- name: NAMESPACE
26+
valueFrom:
27+
fieldRef:
28+
fieldPath: metadata.namespace
2529
volumeMounts:
2630
- name: script
2731
mountPath: /stackable/scripts
@@ -68,9 +72,12 @@ metadata:
6872
name: test-opensearch
6973
data:
7074
test.py: |
75+
import os
7176
from opensearchpy import OpenSearch
7277
73-
host = 'opensearch'
78+
namespace = os.environ['NAMESPACE']
79+
80+
host = f'opensearch.{namespace}.svc.cluster.local'
7481
port = 9200
7582
auth = ('integrationtest', 'integrationtest')
7683
ca_certs_path = '/stackable/tls/ca.crt'
@@ -81,8 +88,6 @@ data:
8188
http_auth = auth,
8289
use_ssl = True,
8390
verify_certs = True,
84-
ssl_assert_hostname = False,
85-
ssl_show_warn = False,
8691
ca_certs = ca_certs_path
8792
)
8893

tests/templates/kuttl/metrics/20-install-opensearch.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ spec:
2727
storage:
2828
data:
2929
capacity: 100Mi
30-
listenerClass: external-stable
30+
listenerClass: external-unstable
3131
replicas: 3
3232
configOverrides:
3333
opensearch.yml:

tests/templates/kuttl/opensearch-dashboards/10-install-opensearch.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
roleGroups:
2424
default:
2525
config:
26-
listenerClass: external-stable
26+
listenerClass: external-unstable
2727
replicas: 1
2828
podOverrides:
2929
spec:

tests/templates/kuttl/smoke/10-assert.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ metadata:
869869
kind: OpenSearchCluster
870870
name: opensearch
871871
spec:
872-
className: external-stable
872+
className: external-unstable
873873
extraPodSelectorLabels: {}
874874
ports:
875875
- name: http

tests/templates/kuttl/smoke/10-install-opensearch.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ spec:
2929
storage:
3030
data:
3131
capacity: 100Mi
32-
listenerClass: external-stable
32+
listenerClass: external-unstable
3333
replicas: 3
3434
podOverrides:
3535
spec:

tests/templates/kuttl/smoke/20-test-opensearch.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ spec:
2222
# required for pip install
2323
- name: HOME
2424
value: /stackable
25+
- name: NAMESPACE
26+
valueFrom:
27+
fieldRef:
28+
fieldPath: metadata.namespace
2529
volumeMounts:
2630
- name: script
2731
mountPath: /stackable/scripts
@@ -70,9 +74,12 @@ data:
7074
test.py: |
7175
# https://docs.opensearch.org/docs/latest/clients/python-low-level/#sample-program
7276
77+
import os
7378
from opensearchpy import OpenSearch
7479
75-
host = 'opensearch'
80+
namespace = os.environ['NAMESPACE']
81+
82+
host = f'opensearch.{namespace}.svc.cluster.local'
7683
port = 9200
7784
auth = ('admin', 'AJVFsGJBbpT6mChn') # For testing only. Don't store credentials in code.
7885
ca_certs_path = '/stackable/tls/ca.crt'
@@ -84,8 +91,6 @@ data:
8491
http_auth = auth,
8592
use_ssl = True,
8693
verify_certs = True,
87-
ssl_assert_hostname = False,
88-
ssl_show_warn = False,
8994
ca_certs = ca_certs_path
9095
)
9196
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# see https://github.com/stackabletech/issues/issues/566
2+
---
3+
apiVersion: kuttl.dev/v1beta1
4+
kind: TestStep
5+
commands:
6+
- script: |
7+
kubectl patch namespace $NAMESPACE --patch='
8+
{
9+
"metadata": {
10+
"labels": {
11+
"pod-security.kubernetes.io/enforce": "privileged"
12+
}
13+
}
14+
}'
15+
timeout: 120
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: test-service-account
6+
---
7+
kind: Role
8+
apiVersion: rbac.authorization.k8s.io/v1
9+
metadata:
10+
name: test-role
11+
rules:
12+
- apiGroups:
13+
- security.openshift.io
14+
resources:
15+
- securitycontextconstraints
16+
resourceNames:
17+
- privileged
18+
verbs:
19+
- use
20+
---
21+
kind: RoleBinding
22+
apiVersion: rbac.authorization.k8s.io/v1
23+
metadata:
24+
name: test-role-binding
25+
subjects:
26+
- kind: ServiceAccount
27+
name: test-service-account
28+
roleRef:
29+
apiGroup: rbac.authorization.k8s.io
30+
kind: Role
31+
name: test-role
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
5+
---
6+
apiVersion: v1
7+
kind: ConfigMap
8+
metadata:
9+
name: vector-aggregator-discovery
10+
{% endif %}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% if lookup('env', 'VECTOR_AGGREGATOR') %}
2+
---
3+
apiVersion: v1
4+
kind: ConfigMap
5+
metadata:
6+
name: vector-aggregator-discovery
7+
data:
8+
ADDRESS: {{ lookup('env', 'VECTOR_AGGREGATOR') }}
9+
{% endif %}

0 commit comments

Comments
 (0)