Skip to content

Commit

Permalink
Merge pull request valkey-io#1788 from aws/full_tests_on_macos_rebased
Browse files Browse the repository at this point in the history
Full tests on macos
  • Loading branch information
ikolomi authored Jul 8, 2024
2 parents 58266d5 + 609e9fe commit 0bf25d1
Show file tree
Hide file tree
Showing 5 changed files with 1,074 additions and 883 deletions.
87 changes: 81 additions & 6 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
test-ubuntu-latest:
runs-on: ubuntu-latest
needs: load-engine-matrix
timeout-minutes: 25
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -128,6 +128,46 @@ jobs:
with:
language-flag: -python

test-pubsub-ubuntu-latest:
runs-on: ubuntu-latest
needs: load-engine-matrix
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
engine: ${{ fromJson(needs.load-engine-matrix.outputs.matrix) }}
python:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Build Python wrapper
uses: ./.github/workflows/build-python-wrapper
with:
os: "ubuntu"
target: "x86_64-unknown-linux-gnu"
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: ${{ matrix.engine.version }}

- name: Test pubsub with pytest
working-directory: ./python
run: |
source .env/bin/activate
cd python/tests/
pytest --asyncio-mode=auto -k test_pubsub
lint-rust:
runs-on: ubuntu-latest
timeout-minutes: 15
Expand All @@ -141,9 +181,14 @@ jobs:
cargo-toml-folder: ./python
name: lint python-rust

build-macos-latest:
test-macos-latest:
runs-on: macos-latest
timeout-minutes: 25
needs: load-engine-matrix
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
engine: ${{ fromJson(needs.load-engine-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -157,13 +202,43 @@ jobs:
os: "macos"
target: "aarch64-apple-darwin"
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: "7.2.5"
engine-version: ${{ matrix.engine.version }}

- name: Test compatibility with pytest
- name: Test with pytest
working-directory: ./python
run: |
source .env/bin/activate
pytest --asyncio-mode=auto -m smoke_test
pytest --asyncio-mode=auto
test-pubsub-macos-latest:
runs-on: macos-latest
needs: load-engine-matrix
timeout-minutes: 35
strategy:
fail-fast: false
matrix:
engine: ${{ fromJson(needs.load-engine-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Build Python wrapper
uses: ./.github/workflows/build-python-wrapper
with:
os: "macos"
target: "aarch64-apple-darwin"
github-token: ${{ secrets.GITHUB_TOKEN }}
engine-version: ${{ matrix.engine.version }}

- name: Test pubsub with pytest
working-directory: ./python
run: |
source .env/bin/activate
cd python/tests/
pytest --asyncio-mode=auto -k test_pubsub
build-amazonlinux-latest:
runs-on: ubuntu-latest
Expand Down
12 changes: 9 additions & 3 deletions glide-core/src/socket_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,15 @@ impl UnixStreamListener {
return ReadSocketClosed.into();
}
Ok(_) => {
return match self.rotating_buffer.get_requests() {
Ok(requests) => ReceivedValues(requests),
Err(err) => UnhandledError(err.into()).into(),
match self.rotating_buffer.get_requests() {
Ok(requests) => {
if !requests.is_empty() {
return ReceivedValues(requests);
}
// continue to read from socket
continue;
}
Err(err) => return UnhandledError(err.into()).into(),
};
}
Err(ref e)
Expand Down
1 change: 0 additions & 1 deletion python/pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[pytest]
markers =
smoke_test: mark a test as a build verification testing.
# TODO: Remove pubsub exclusion after the flakey tests are fixed
addopts = -k "not server_modules and not pubsub"
2 changes: 1 addition & 1 deletion python/python/glide/glide_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ async def close(self, err_message: Optional[str] = None) -> None:
try:
self._pubsub_lock.acquire()
for pubsub_future in self._pubsub_futures:
if not response_future.done() and not pubsub_future.cancelled():
if not pubsub_future.done() and not pubsub_future.cancelled():
pubsub_future.set_exception(ClosingError(""))
finally:
self._pubsub_lock.release()
Expand Down
Loading

0 comments on commit 0bf25d1

Please sign in to comment.