Skip to content

Commit e8e88d8

Browse files
committed
Updated search e2e tests
1 parent bfab8ae commit e8e88d8

File tree

4 files changed

+50
-49
lines changed

4 files changed

+50
-49
lines changed

docker/mongodb-kubernetes-init-ops-manager/mmsconfiguration/edit_mms_configuration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func readLinesFromFile(name string) ([]string, error) {
145145
func writeLinesToFile(name string, lines []string) error {
146146
output := strings.Join(lines, lineBreak)
147147

148-
err := os.WriteFile(name, []byte(output), 0o775)
148+
err := os.WriteFile(name, []byte(output), 0o644)
149149
if err != nil {
150150
return xerrors.Errorf("error writing to file %s: %w", name, err)
151151
}
@@ -168,7 +168,7 @@ func appendLinesToFile(name string, lines string) error {
168168

169169
func getOmPropertiesFromEnvVars() map[string]string {
170170
props := map[string]string{}
171-
for _, pair := range os.Environ() {
171+
for _, pair := range os.Environ() { // nolint:forbidigo
172172
if !strings.HasPrefix(pair, omPropertyPrefix) {
173173
continue
174174
}

docker/mongodb-kubernetes-tests/tests/search/fixtures/community-replicaset-sample-mflix.yaml

Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,66 @@ kind: MongoDBCommunity
44
metadata:
55
name: mdbc-rs
66
spec:
7-
members: 3
7+
version: 8.0.10
88
type: ReplicaSet
9-
version: "8.0.10"
9+
members: 3
1010
security:
1111
authentication:
12-
modes: ["SCRAM-SHA-1"]
12+
ignoreUnknownUsers: true
13+
modes:
14+
- SCRAM
1315
agent:
1416
logLevel: DEBUG
17+
statefulSet:
18+
spec:
19+
template:
20+
spec:
21+
containers:
22+
- name: mongod
23+
resources:
24+
limits:
25+
cpu: "2"
26+
memory: 2Gi
27+
requests:
28+
cpu: "1"
29+
memory: 1Gi
30+
- name: mongodb-agent
31+
resources:
32+
limits:
33+
cpu: "1"
34+
memory: 2Gi
35+
requests:
36+
cpu: "0.5"
37+
memory: 1Gi
1538
users:
39+
# admin user with root role
1640
- name: mdb-admin
1741
db: admin
18-
passwordSecretRef: # a reference to the secret that will be used to generate the user's password
42+
passwordSecretRef: # a reference to the secret containing user password
1943
name: mdb-admin-user-password
44+
scramCredentialsSecretName: mdb-admin-user
2045
roles:
2146
- name: root
2247
db: admin
23-
scramCredentialsSecretName: mdb-admin-user-scram
48+
# user performing search queries
2449
- name: mdb-user
2550
db: admin
26-
passwordSecretRef: # a reference to the secret that will be used to generate the user's password
51+
passwordSecretRef: # a reference to the secret containing user password
2752
name: mdb-user-password
53+
scramCredentialsSecretName: mdb-user-scram
2854
roles:
2955
- name: restore
3056
db: sample_mflix
3157
- name: readWrite
3258
db: sample_mflix
33-
scramCredentialsSecretName: mdb-user-scram
34-
- name: mongot-user
59+
# user used by MongoDB Search to connect to MongoDB database to synchronize data from
60+
# For MongoDB <8.2, the operator will be creating the searchCoordinator custom role automatically
61+
# From MongoDB 8.2, searchCoordinator role will be a built-in role.
62+
- name: search-sync-source
3563
db: admin
3664
passwordSecretRef: # a reference to the secret that will be used to generate the user's password
37-
name: mdbc-rs-mongot-user-password
65+
name: mdbc-rs-search-sync-source-password
66+
scramCredentialsSecretName: mdbc-rs-search-sync-source
3867
roles:
3968
- name: searchCoordinator
4069
db: admin
41-
scramCredentialsSecretName: mongot-user-scram
42-
statefulSet:
43-
spec:
44-
template:
45-
spec:
46-
containers:
47-
- name: mongod
48-
resources:
49-
limits:
50-
cpu: "3"
51-
memory: 5Gi
52-
requests:
53-
cpu: "2"
54-
memory: 5Gi
55-
- name: mongodb-agent
56-
resources:
57-
limits:
58-
cpu: "3"
59-
memory: 5Gi
60-
requests:
61-
cpu: "2"
62-
memory: 5Gi

docker/mongodb-kubernetes-tests/tests/search/search_community_basic.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
ADMIN_USER_NAME = "mdb-admin-user"
1616
ADMIN_USER_PASSWORD = "mdb-admin-user-pass"
1717

18-
MONGOT_USER_NAME = "mongot-user"
19-
MONGOT_USER_PASSWORD = "mongot-user-password"
18+
MONGOT_USER_NAME = "search-sync-source"
19+
MONGOT_USER_PASSWORD = "search-sync-source-user-password"
2020

2121
USER_NAME = "mdb-user"
2222
USER_PASSWORD = "mdb-user-pass"
@@ -32,8 +32,8 @@ def mdbc(namespace: str) -> MongoDBCommunity:
3232
namespace=namespace,
3333
)
3434

35-
# if try_load(resource):
36-
# return resource
35+
if try_load(resource):
36+
return resource
3737

3838
return resource
3939

@@ -45,8 +45,8 @@ def mdbs(namespace: str) -> MongoDBSearch:
4545
namespace=namespace,
4646
)
4747

48-
# if try_load(resource):
49-
# return resource
48+
if try_load(resource):
49+
return resource
5050

5151
return resource
5252

@@ -75,7 +75,7 @@ def test_create_database_resource(mdbc: MongoDBCommunity):
7575

7676

7777
@mark.e2e_search_community_basic
78-
def test_create_search_resource(mdbs: MongoDBSearch, mdbc: MongoDBCommunity):
78+
def test_create_search_resource(mdbs: MongoDBSearch):
7979
mdbs.update()
8080
mdbs.assert_reaches_phase(Phase.Running, timeout=300)
8181

@@ -102,11 +102,6 @@ def test_search_create_search_index(sample_movies_helper: SampleMoviesSearchHelp
102102
sample_movies_helper.create_search_index()
103103

104104

105-
# @mark.e2e_search_community_basic
106-
# def test_search_wait_for_search_indexes(sample_movies_helper: SampleMoviesSearchHelper):
107-
# sample_movies_helper.wait_for_search_indexes()
108-
109-
110105
@mark.e2e_search_community_basic
111106
def test_search_assert_search_query(sample_movies_helper: SampleMoviesSearchHelper):
112107
sample_movies_helper.assert_search_query(retry_timeout=60)

docs/community-search/quick-start/code_snippets/0310_create_mongodb_community_resource.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ spec:
4141
db: admin
4242
passwordSecretRef: # a reference to the secret containing user password
4343
name: mdb-admin-user-password
44-
scramCredentialsSecretName: mdb-admin-user-scram
44+
scramCredentialsSecretName: mdb-admin-user
4545
roles:
4646
- name: root
4747
db: admin
@@ -61,10 +61,9 @@ spec:
6161
# From MongoDB 8.2, searchCoordinator role will be a built-in role.
6262
- name: search-sync-source
6363
db: admin
64-
passwordSecretRef: # a reference to the secret containing user password
64+
passwordSecretRef: # a reference to the secret that will be used to generate the user's password
6565
name: mdbc-rs-search-sync-source-password
66-
scramCredentialsSecretName: mdb-rs-search-sync-source
66+
scramCredentialsSecretName: mdbc-rs-search-sync-source
6767
roles:
6868
- name: searchCoordinator
6969
db: admin
70-
EOF

0 commit comments

Comments
 (0)