Skip to content

Commit

Permalink
test flakiness improvements (#1765)
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem authored Jan 24, 2024
1 parent 4d7edf7 commit ed4c60c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/nucliadb_search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ jobs:
max-parallel: 2
matrix:
include:
# - maindb_driver: "tikv"
# storage_backend: "gcs"
# python-version: "3.11"
- maindb_driver: "tikv"
storage_backend: "gcs"
python-version: "3.11"
- maindb_driver: "tikv"
storage_backend: "s3"
python-version: "3.11"
# - maindb_driver: "pg"
# storage_backend: "gcs"
# python-version: "3.11"
- maindb_driver: "pg"
storage_backend: "gcs"
python-version: "3.11"

steps:
- name: Checkout the repository
Expand Down
18 changes: 16 additions & 2 deletions nucliadb_utils/nucliadb_utils/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import random
import socket


def free_port() -> int:
import socket
def free_port(retries=20) -> int:
port_range_start = 1024 # Start of the port range (1024 is usually safe)
port_range_end = 65535 # End of the port range

for _ in range(retries):
port = random.randint(port_range_start, port_range_end)
try:
sock = socket.socket()
sock.bind(("", port))
sock.close()
return port
except OSError:
continue

# give up and let OS pick a free port
sock = socket.socket()
sock.bind(("", 0))
port = sock.getsockname()[1]
Expand Down

3 comments on commit ed4c60c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: ed4c60c Previous: c67870a Ratio
nucliadb/search/tests/unit/search/test_fetch.py::test_highligh_error 13110.30520569934 iter/sec (stddev: 6.41715285126289e-7) 12887.24555746259 iter/sec (stddev: 2.385970996903907e-7) 0.98

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: ed4c60c Previous: c67870a Ratio
nucliadb/search/tests/unit/search/test_fetch.py::test_highligh_error 12917.864020255198 iter/sec (stddev: 5.453310944904501e-7) 12887.24555746259 iter/sec (stddev: 2.385970996903907e-7) 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: ed4c60c Previous: c67870a Ratio
nucliadb/search/tests/unit/search/test_fetch.py::test_highligh_error 12544.781963636364 iter/sec (stddev: 1.4538887832420261e-7) 12887.24555746259 iter/sec (stddev: 2.385970996903907e-7) 1.03

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.