Skip to content

Commit

Permalink
[main] add a test that used to fail for grpcio (with old abseil) (#315)
Browse files Browse the repository at this point in the history
automerged PR by conda-forge/automerge-action
  • Loading branch information
github-actions[bot] authored Sep 10, 2023
2 parents 6dbff2c + d5359b1 commit df8d5e1
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 36 deletions.
21 changes: 0 additions & 21 deletions .ci_support/migrations/abseil_cpp202206230.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
__migrator:
build_number: 1
kind: version
migration_number: 1
libabseil:
- 20230802
libgrpc:
- "1.57"
libprotobuf:
- 4.23.4
MACOSX_DEPLOYMENT_TARGET: # [osx and x86_64]
- "10.13" # [osx and x86_64]
migrator_ts: 1692632590.658328
2 changes: 0 additions & 2 deletions .ci_support/osx_64_.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
MACOSX_DEPLOYMENT_TARGET:
- '10.13'
MACOSX_SDK_VERSION:
- '10.13'
c_ares:
- '1'
c_compiler:
Expand Down
12 changes: 0 additions & 12 deletions recipe/conda_build_config.yaml

This file was deleted.

16 changes: 15 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ outputs:
build:
run_exports:
- {{ pin_subpackage('libgrpc', max_pin='x.x') }}
# grpc requires C11 aligned_alloc as of 1.56;
# ensure that all dependent packages reflect that to
# avoid the solver getting stuck in no-man's-land.
- __osx >={{ MACOSX_DEPLOYMENT_TARGET }} # [osx and x86_64]
requirements:
build:
- {{ compiler('c') }}
Expand Down Expand Up @@ -87,7 +91,7 @@ outputs:
- ninja
- pkg-config
# only required for pkg-config test (which wants to find zlib.pc)
- zlib # [win]
- zlib
files:
- cmake_test/
- hello.proto
Expand Down Expand Up @@ -155,10 +159,14 @@ outputs:
- {{ pin_subpackage('libgrpc', exact=True) }}
- __osx >={{ MACOSX_DEPLOYMENT_TARGET|default("10.9") }} # [osx and x86_64]
test:
source_files:
- examples/
files:
- grpcio_distribtest.py
- test_grpcio_helloworld.py
requires:
- pip
- protobuf
imports:
- grpc
- grpc._cython
Expand All @@ -173,6 +181,12 @@ outputs:
commands:
- python -m pip check
- python grpcio_distribtest.py
# test actual RPC pattern (client & server); other tests did not catch
# https://github.com/conda-forge/grpc-cpp-feedstock/issues/281
- cd examples/python/helloworld
# copy test defined in feedstock to where it needs to run
- cp ../../../test_grpcio_helloworld.py .
- python test_grpcio_helloworld.py

about:
home: https://grpc.io/
Expand Down
31 changes: 31 additions & 0 deletions recipe/test_grpcio_helloworld.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os
import signal
import subprocess
import sys
import time

# this test assumes it is being run in examples/python/helloworld,
# after having generated the helloworld_pb2{,_grpc} modules (see meta.yaml)
import grpc
import helloworld_pb2
import helloworld_pb2_grpc


# start server (and wait a little)
print('Starting server...')
pid = subprocess.Popen([sys.executable, "greeter_server.py"]).pid
time.sleep(5)

# run this a couple times because it happens randomly, see
# https://github.com/conda-forge/grpc-cpp-feedstock/issues/281
print('Running client...')
for _ in range(1000):
with grpc.insecure_channel('localhost:50051') as channel:
stub = helloworld_pb2_grpc.GreeterStub(channel)
response = stub.SayHello(helloworld_pb2.HelloRequest(name='you'))

# tear down server
print('Terminating server...')
os.kill(pid, signal.SIGTERM)

print('Success!')

0 comments on commit df8d5e1

Please sign in to comment.