Skip to content

Commit 548fc39

Browse files
committed
cleanup
1 parent 648facd commit 548fc39

File tree

5 files changed

+8
-76
lines changed

5 files changed

+8
-76
lines changed

controllers/searchcontroller/mongodbsearch_reconcile_helper_test.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -152,58 +152,3 @@ func TestGetMongodConfigParameters_TransportAndPorts(t *testing.T) {
152152
})
153153
}
154154
}
155-
156-
func TestGetMongodConfigParameters_TransportAndPorts(t *testing.T) {
157-
cases := []struct {
158-
name string
159-
withWireproto bool
160-
expectedUseGrpc bool
161-
}{
162-
{
163-
name: "grpc only (default)",
164-
withWireproto: false,
165-
expectedUseGrpc: true,
166-
},
167-
{
168-
name: "grpc + wireproto via annotation",
169-
withWireproto: true,
170-
expectedUseGrpc: false,
171-
},
172-
}
173-
174-
for _, tc := range cases {
175-
t.Run(tc.name, func(t *testing.T) {
176-
search := &searchv1.MongoDBSearch{
177-
ObjectMeta: metav1.ObjectMeta{
178-
Name: "test-mongodb-search",
179-
Namespace: "test",
180-
},
181-
}
182-
if tc.withWireproto {
183-
search.Annotations = map[string]string{searchv1.ForceWireprotoAnnotation: "true"}
184-
}
185-
186-
clusterDomain := "cluster.local"
187-
params := GetMongodConfigParameters(search, clusterDomain)
188-
189-
setParams := params["setParameter"].(map[string]any)
190-
191-
useGrpc := setParams["useGrpcForSearch"].(bool)
192-
assert.Equal(t, tc.expectedUseGrpc, useGrpc)
193-
194-
expectedPort := search.GetMongotGrpcPort()
195-
if tc.withWireproto {
196-
expectedPort = search.GetMongotWireprotoPort()
197-
}
198-
expectedPrefix := fmt.Sprintf("%s.%s.svc.%s", search.Name+"-search-svc", search.Namespace, clusterDomain)
199-
expectedSuffix := fmt.Sprintf(":%d", expectedPort)
200-
201-
for _, key := range []string{"mongotHost", "searchIndexManagementHostAndPort"} {
202-
value := setParams[key].(string)
203-
if !strings.HasPrefix(value, expectedPrefix) || !strings.HasSuffix(value, expectedSuffix) {
204-
t.Fatalf("%s mismatch: expected prefix %q and suffix %q, got %q", key, expectedPrefix, expectedSuffix, value)
205-
}
206-
}
207-
})
208-
}
209-
}

docs/search/01-search-community-deploy/code_snippets/01_0040_validate_env.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,11 @@ required=(
1414
OPERATOR_HELM_CHART
1515
)
1616

17-
optional=(
18-
OPERATOR_ADDITIONAL_HELM_VALUES
19-
PRERELEASE_IMAGE_PULLSECRET
20-
)
21-
2217
missing_req=()
2318
for v in "${required[@]}"; do [[ -n "${!v:-}" ]] || missing_req+=("$v"); done
2419
if (( ${#missing_req[@]} )); then
2520
echo "ERROR: Missing required environment variables:" >&2
2621
for m in "${missing_req[@]}"; do echo " - $m" >&2; done
27-
exit 1
2822
fi
2923

30-
missing_opt=()
31-
for v in "${optional[@]}"; do [[ -n "${!v:-}" ]] || missing_opt+=("$v"); done
32-
3324
echo "All required environment variables present."
34-
if (( ${#missing_opt[@]} )); then
35-
echo "Optional variables missing (will continue): ${missing_opt[*]}"
36-
fi

docs/search/01-search-community-deploy/code_snippets/01_0307_prepare_cert_manager_issuer.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ EOF_MANIFEST
5050
kubectl --context "${K8S_CTX}" wait --for=condition=Ready clusterissuer "${MDB_TLS_CA_ISSUER}"
5151

5252
TMP_CA_CERT="$(mktemp)"
53-
trap 'rm -f "${TMP_CA_CERT}"' EXIT
5453

5554
kubectl --context "${K8S_CTX}" \
5655
get secret "${MDB_TLS_CA_SECRET_NAME}" -n "${CERT_MANAGER_NAMESPACE}" \

docs/search/01-search-community-deploy/env_variables.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ export OPERATOR_HELM_CHART="mongodb/mongodb-kubernetes"
3434
export OPERATOR_ADDITIONAL_HELM_VALUES=""
3535

3636
# TLS is mandatory; connection string must include tls=true
37-
export MDB_CONNECTION_STRING="mongodb://mdb-user:${MDB_USER_PASSWORD}@${MDB_RESOURCE_NAME}-0.${MDB_RESOURCE_NAME}-svc.${MDB_NS}.svc.cluster.local:27017/?replicaSet=${MDB_RESOURCE_NAME}&tls=true"
37+
export MDB_CONNECTION_STRING="mongodb://mdb-user:${MDB_USER_PASSWORD}@${MDB_RESOURCE_NAME}-0.${MDB_RESOURCE_NAME}-svc.${MDB_NS}.svc.cluster.local:27017/?replicaSet=${MDB_RESOURCE_NAME}&tls=true&tlsCAFile=/tls/ca.crt"
3838

3939
export CERT_MANAGER_NAMESPACE="cert-manager"

scripts/code_snippets/tests/outputs/test_kind_search_community_snippets/03_0445_list_vector_search_indexes.out

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
ns: 'sample_mflix.embedded_movies',
55
firstBatch: [
66
{
7-
id: '6900e503c2c18a60ebc367dd',
7+
id: '68c974a12bc7c076f12cd34e',
88
name: 'vector_index',
99
type: 'vectorSearch',
1010
latestDefinition: {
1111
type: 'vectorSearch',
12-
indexID: ObjectId('6900e503c2c18a60ebc367dd'),
12+
indexID: ObjectId('68c974a12bc7c076f12cd34e'),
1313
name: 'vector_index',
1414
database: 'sample_mflix',
1515
lastObservedCollectionName: 'embedded_movies',
16-
collectionUUID: UUID('a0633632-cf14-4a80-8e35-2fb57bb896c6'),
16+
collectionUUID: UUID('ac18b1d2-d1a2-49a6-9a02-de2bdbf1ecb0'),
1717
numPartitions: 1,
1818
fields: [
1919
{
@@ -30,11 +30,11 @@
3030
},
3131
ok: 1,
3232
'$clusterTime': {
33-
clusterTime: Timestamp({ t: 1761666370, i: 1 }),
33+
clusterTime: Timestamp({ t: 1758033116, i: 1 }),
3434
signature: {
35-
hash: Binary.createFromBase64('aT9ULTNqVJgvq0QazViadCNQQb0=', 0),
36-
keyId: Long('7566297611662000134')
35+
hash: Binary.createFromBase64('Wehb6njq4tsFr6uYMz9n7vyRLAw=', 0),
36+
keyId: Long('7550693115007336453')
3737
}
3838
},
39-
operationTime: Timestamp({ t: 1761666370, i: 1 })
39+
operationTime: Timestamp({ t: 1758033116, i: 1 })
4040
}

0 commit comments

Comments
 (0)