Skip to content

Commit

Permalink
Remove Go server from Python tests (#170)
Browse files Browse the repository at this point in the history
Fixes #156
  • Loading branch information
cretz committed Oct 28, 2022
1 parent 0126e6e commit bc62186
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 1,576 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
# Needed for tests since they use external server
- uses: actions/setup-go@v2
with:
go-version: "1.18"
- run: python -m pip install --upgrade wheel poetry poethepoet
- run: poetry install --no-root -E opentelemetry
- run: poe lint
Expand Down Expand Up @@ -119,10 +115,6 @@ jobs:
- run: poe fix-wheel

# Do test only for ci-arch auto (i.e. local machine)
- if: ${{ matrix.ci-arch == 'auto' }}
uses: actions/setup-go@v2
with:
go-version: "1.18"
- if: ${{ matrix.ci-arch == 'auto' }}
run: poe test-dist-single

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,7 @@ The environment is now ready to develop in.

#### Testing

Tests currently require [Go](https://go.dev/) to be installed since they use an embedded Temporal server as a library.
With `Go` installed, run the following to execute tests:
To execute tests:

```bash
poe test
Expand Down
4 changes: 4 additions & 0 deletions temporalio/testing/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ async def start_local(
retry_config: Optional[temporalio.client.RetryConfig] = None,
rpc_metadata: Mapping[str, str] = {},
identity: Optional[str] = None,
tls: bool | temporalio.client.TLSConfig = False,
ip: str = "127.0.0.1",
port: Optional[int] = None,
download_dest_dir: Optional[str] = None,
Expand Down Expand Up @@ -128,6 +129,8 @@ async def start_local(
:py:meth:`temporalio.client.Client.connect`.
identity: See parameter of the same name on
:py:meth:`temporalio.client.Client.connect`.
tls: See parameter of the same name on
:py:meth:`temporalio.client.Client.connect`.
ip: IP address to bind to, or 127.0.0.1 by default.
port: Port number to bind to, or an OS-provided port by default.
download_dest_dir: Directory to download binary to if a download is
Expand Down Expand Up @@ -189,6 +192,7 @@ async def start_local(
data_converter=data_converter,
interceptors=interceptors,
default_workflow_query_reject_condition=default_workflow_query_reject_condition,
tls=tls,
retry_config=retry_config,
rpc_metadata=rpc_metadata,
identity=identity,
Expand Down
19 changes: 10 additions & 9 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

from temporalio.client import Client
from temporalio.testing import WorkflowEnvironment
from tests.helpers.golang import ExternalGolangServer
from tests.helpers.worker import ExternalPythonWorker, ExternalWorker

# Due to https://github.com/python/cpython/issues/77906, multiprocessing on
Expand Down Expand Up @@ -55,18 +54,20 @@ def event_loop():
loop.close()


@pytest_asyncio.fixture(scope="session")
async def golang_server() -> AsyncGenerator[ExternalGolangServer, None]:
server = await ExternalGolangServer.start()
yield server
await server.close()
@pytest.fixture(scope="session")
def env_type(request: pytest.FixtureRequest) -> str:
return request.config.getoption("--workflow-environment")


@pytest_asyncio.fixture(scope="session")
async def env(request) -> AsyncGenerator[WorkflowEnvironment, None]:
env_type = request.config.getoption("--workflow-environment")
async def env(env_type: str) -> AsyncGenerator[WorkflowEnvironment, None]:
if env_type == "local":
env = await WorkflowEnvironment.start_local()
env = await WorkflowEnvironment.start_local(
temporalite_extra_args=[
"--dynamic-config-value",
"system.forceSearchAttributesCacheRefreshOnRead=true",
]
)
elif env_type == "time-skipping":
env = await WorkflowEnvironment.start_time_skipping()
else:
Expand Down
94 changes: 0 additions & 94 deletions tests/helpers/golang.py

This file was deleted.

2 changes: 0 additions & 2 deletions tests/helpers/golangserver/certs/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions tests/helpers/golangserver/certs/client-ca-cert.pem

This file was deleted.

5 changes: 0 additions & 5 deletions tests/helpers/golangserver/certs/client-ca-key.pem

This file was deleted.

11 changes: 0 additions & 11 deletions tests/helpers/golangserver/certs/client-cert.pem

This file was deleted.

5 changes: 0 additions & 5 deletions tests/helpers/golangserver/certs/client-key.pem

This file was deleted.

101 changes: 0 additions & 101 deletions tests/helpers/golangserver/certs/gen.go

This file was deleted.

12 changes: 0 additions & 12 deletions tests/helpers/golangserver/certs/server-ca-cert.pem

This file was deleted.

5 changes: 0 additions & 5 deletions tests/helpers/golangserver/certs/server-ca-key.pem

This file was deleted.

11 changes: 0 additions & 11 deletions tests/helpers/golangserver/certs/server-cert.pem

This file was deleted.

5 changes: 0 additions & 5 deletions tests/helpers/golangserver/certs/server-key.pem

This file was deleted.

Loading

0 comments on commit bc62186

Please sign in to comment.