| 1 |
# --- BEGIN COPYRIGHT BLOCK --- |
| 2 |
# Copyright (C) 2019 William Brown <[email protected]> |
| 3 |
# Copyright (C) 2020 Red Hat, Inc. |
| 4 |
# All rights reserved. |
| 5 |
# |
| 6 |
# License: GPL (version 3 or any later version). |
| 7 |
# See LICENSE for details. |
| 8 |
# --- END COPYRIGHT BLOCK --- |
| 9 |
# |
| 10 |
|
| 11 |
from test389.topologies import topology_st |
| 12 |
from lib389.dbgen import dbgen_users |
| 13 |
from lib389.ldclt import Ldclt |
| 14 |
from lib389.tasks import ImportTask |
| 15 |
from lib389._constants import DEFAULT_SUFFIX |
| 16 |
|
| 17 |
|
| 18 |
def test_stress_search_simple(topology_st): |
| 19 |
"""Test a simple stress test of searches on the directory server. |
| 20 |
|
| 21 |
:id: 3786d01c-ea03-4655-a4f9-450693c75863 |
| 22 |
:setup: Standalone Instance |
| 23 |
:steps: |
| 24 |
1. Create test users |
| 25 |
2. Import them |
| 26 |
3. Stress test! |
| 27 |
:expectedresults: |
| 28 |
1. Success |
| 29 |
2. Success |
| 30 |
3. Results are written to /tmp |
| 31 |
""" |
| 32 |
|
| 33 |
inst = topology_st.standalone |
| 34 |
inst.config.set("nsslapd-verify-filter-schema", "off") |
| 35 |
# Bump idllimit to test OR worst cases. |
| 36 |
from lib389.config import LDBMConfig |
| 37 |
lconfig = LDBMConfig(inst) |
| 38 |
# lconfig.set("nsslapd-idlistscanlimit", '20000') |
| 39 |
# lconfig.set("nsslapd-lookthroughlimit", '20000') |
| 40 |
|
| 41 |
ldif_dir = inst.get_ldif_dir() |
| 42 |
import_ldif = ldif_dir + '/basic_import.ldif' |
| 43 |
dbgen_users(inst, 10000, import_ldif, DEFAULT_SUFFIX) |
| 44 |
|
| 45 |
r = ImportTask(inst) |
| 46 |
r.import_suffix_from_ldif(ldiffile=import_ldif, suffix=DEFAULT_SUFFIX) |
| 47 |
r.wait() |
| 48 |
|
| 49 |
# Run a small to warm up the server's caches ... |
| 50 |
l = Ldclt(inst) |
| 51 |
l.search_loadtest(DEFAULT_SUFFIX, "([email protected])", rounds=1) |
| 52 |
|
| 53 |
# Now do it for realsies! |
| 54 |
# l.search_loadtest(DEFAULT_SUFFIX, "(|([email protected])(nonexist=foo))", rounds=10) |
| 55 |
l.search_loadtest(DEFAULT_SUFFIX, "([email protected])", rounds=10) |