Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/momento-local-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ jobs:
runs-on: ${{ matrix.os }}

env:
TEST_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
MOMENTO_API_KEY: ${{ secrets.ALPHA_API_KEY_V2 }}
MOMENTO_ENDPOINT: "cell-alpha-dev.preprod.a.momentohq.com"
V1_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_CACHE_NAME: python-integration-test-${{ matrix.python-version }}-${{ matrix.new-python-protobuf }}-${{ github.sha }}

steps:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
pull_request:
branches: [main]

env:
V1_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
MOMENTO_API_KEY: ${{ secrets.ALPHA_API_KEY_V2 }}
MOMENTO_ENDPOINT: "cell-alpha-dev.preprod.a.momentohq.com"

jobs:
test:
strategy:
Expand All @@ -15,7 +20,6 @@ jobs:
runs-on: ${{ matrix.os }}

env:
TEST_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
TEST_CACHE_NAME: python-integration-test-${{ matrix.python-version }}-${{ matrix.new-python-protobuf }}-${{ github.sha }}

steps:
Expand Down Expand Up @@ -78,10 +82,6 @@ jobs:
# the cache for one job in another job.
max-parallel: 1

env:
# TODO: remove token stored as secret in favor of using a
# momento-local instance that can be spun up for testing
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -139,6 +139,7 @@ jobs:
poetry run python -m ${{ matrix.package }}.quickstart
poetry run python -m ${{ matrix.package }}.example
poetry run python -m ${{ matrix.package }}.example_async
poetry run python -m ${{ matrix.package }}.topic_publish

- name: Run docs samples for python >= 3.10
id: docs-ex-validation
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,13 @@ poetry run isort .

## Tests :zap:

Integration tests require an api key for testing. Set the env var `TEST_API_KEY` to
Integration tests require an api key for testing. Set the env vars `MOMENTO_API_KEY` and `MOMENTO_ENDPOINT` to
provide it. The env `TEST_CACHE_NAME` is also required, but for now any string value works.

Example of running tests against all python versions:

```
TEST_API_KEY=<api key> TEST_CACHE_NAME=<cache name> poetry run pytest
MOMENTO_API_KEY=<api key> MOMENTO_ENDPOINT=<endpoint> TEST_CACHE_NAME=<cache name> poetry run pytest
```

### For M1 Users
Expand All @@ -188,7 +188,7 @@ a github issue with us to let us know. And in the meantime you can work around
issue by installing Rosetta 2 and re-running with:

```
arch -x86_64 TEST_API_KEY=<api key> TEST_CACHE_NAME=<cache name> poetry run pytest
arch -x86_64 MOMENTO_API_KEY=<api key> MOMENTO_ENDPOINT=<endpoint> TEST_CACHE_NAME=<cache name> poetry run pytest
```

### Developing new test cases?
Expand Down
35 changes: 18 additions & 17 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ _Read this in other languages_: [日本語](README.ja.md)

- [Python 3.7 or above is required](https://www.python.org/downloads/)
- To get started with Momento you will need a Momento API key. You can get one from the [Momento Console](https://console.gomomento.com).
- A Momento service endpoint is required. You can find a [list of them here](https://docs.momentohq.com/platform/regions)
- Developer libraries (gcc/python dev headers) installed on machine you intend to run on

**Amazon Linux**
Expand Down Expand Up @@ -44,29 +45,29 @@ poetry install
To run the python version 3.10+ examples:

```bash
MOMENTO_API_KEY=<YOUR_API_KEY> poetry run python -m py310.example
MOMENTO_API_KEY=<YOUR_API_KEY> poetry run python -m py310.example_async
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m py310.example
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m py310.example_async
```

To run the examples with SDK debug logging enabled:

```bash
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> poetry run python -m py310.example
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> poetry run python -m py310.example_async
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m py310.example
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m py310.example_async
```

To run the python version <3.10 examples:

```bash
MOMENTO_API_KEY=<YOUR_API_KEY> poetry run python -m prepy310.example
MOMENTO_API_KEY=<YOUR_API_KEY> poetry run python -m prepy310.example_async
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m prepy310.example
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m prepy310.example_async
```

To run the examples with SDK debug logging enabled:

```bash
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> poetry run python -m prepy310.example
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> poetry run python -m prepy310.example_async
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m prepy310.example
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m prepy310.example_async
```

## Running the Example Using pip
Expand All @@ -80,29 +81,29 @@ pip install -r requirements.txt
To run the python version 3.10+ examples:

```bash
MOMENTO_API_KEY=<YOUR_API_KEY> python -m py310.example
MOMENTO_API_KEY=<YOUR_API_KEY> python -m py310.example_async
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> python -m py310.example
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> python -m py310.example_async
```

To run the examples with SDK debug logging enabled:

```bash
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> python -m py310.example
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> python -m py310.example_async
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> python -m py310.example
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> python -m py310.example_async
```

To run the python version <3.10 examples:

```bash
MOMENTO_API_KEY=<YOUR_API_KEY> python -m prepy310.example
MOMENTO_API_KEY=<YOUR_API_KEY> python -m prepy310.example_async
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> python -m prepy310.example
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> python -m prepy310.example_async
```

To run the examples with SDK debug logging enabled:

```bash
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> python -m prepy310.example
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> python -m prepy310.example_async
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> python -m prepy310.example
DEBUG=true MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> python -m prepy310.example_async
```

## Running the load generator example
Expand Down Expand Up @@ -135,7 +136,7 @@ To run the load generator:

```bash
# Run example load generator
MOMENTO_API_KEY=<YOUR AUTH TOKEN> poetry run python -m py310.example_load_gen
MOMENTO_API_KEY=<YOUR_API_KEY> MOMENTO_ENDPOINT=<YOUR_ENDPOINT> poetry run python -m py310.example_load_gen
```

You can check out the example code in [example_load_gen.py](py310/example_load_gen.py). The configurable
Expand Down
2 changes: 1 addition & 1 deletion examples/observability.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

example_observability_setup_tracing()

_AUTH_PROVIDER = CredentialProvider.from_environment_variable("MOMENTO_API_KEY")
_AUTH_PROVIDER = CredentialProvider.from_environment_variables_v2()
_ITEM_DEFAULT_TTL_SECONDS = timedelta(seconds=60)
_CACHE_NAME = "test-cache"
_KEY = "test-key"
Expand Down
Loading
Loading