Skip to content

Commit 0b6a804

Browse files
Copilotswathipil
andcommitted
Update live testing instructions in CLIENT_DEVELOPER.md
Co-authored-by: swathipil <[email protected]>
1 parent 8d97ceb commit 0b6a804

File tree

1 file changed

+61
-32
lines changed

1 file changed

+61
-32
lines changed

sdk/schemaregistry/azure-schemaregistry/CLIENT_DEVELOPER.md

Lines changed: 61 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -137,45 +137,74 @@ For detailed usage and examples, see the [Avro Encoder README](https://github.co
137137

138138
## Running Tests
139139

140-
### Unit and Integration Tests
140+
### Live Tests
141141

142-
1. Set up test resources following the patterns in `conftest.py`
143-
2. Run tests using pytest:
142+
1. Login to Azure:
144143
```bash
145-
# Run all tests
146-
pytest tests/
144+
az login
145+
```
147146

148-
# Run specific test files
149-
pytest tests/test_schema_registry.py
150-
pytest tests/test_json_encoder.py
147+
2. Set required environment variables (or create a `.env` file):
151148

152-
# Run async tests
153-
pytest tests/async_tests/
149+
The following need to be set to run live tests locally and authenticate with AzureCliCredential:
150+
```
151+
SCHEMAREGISTRY_AVRO_FULLY_QUALIFIED_NAMESPACE
152+
SCHEMAREGISTRY_JSON_FULLY_QUALIFIED_NAMESPACE
153+
SCHEMAREGISTRY_CUSTOM_FULLY_QUALIFIED_NAMESPACE
154+
SCHEMAREGISTRY_GROUP
155+
AZURE_TEST_RUN_LIVE=true
156+
```
157+
* Each namespace is Standard tier. Each namespace has one schema group, with schema type set as per namespace.
158+
* The schema group name is the same across namespaces.
159+
160+
If using CLI:
161+
```
162+
AZURE_TEST_USE_CLI_AUTH=true
154163
```
155164

156-
### Live Tests
165+
OR
166+
167+
If using pwsh:
168+
```
169+
AZURE_TEST_USE_PWSH_AUTH=true
170+
```
157171

158-
Live tests require an Azure Schema Registry namespace. Set the following environment variables:
159-
160-
```bash
161-
# Required for live tests
162-
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
163-
SCHEMAREGISTRY_FULLY_QUALIFIED_NAMESPACE=<your-namespace>.servicebus.windows.net
164-
SCHEMAREGISTRY_GROUP=<your-schema-group>
165-
AZURE_TEST_RUN_LIVE=true
166-
167-
# Authentication (choose one)
168-
AZURE_TEST_USE_CLI_AUTH=true # Use Azure CLI authentication
169-
# OR
170-
AZURE_CLIENT_ID=<service-principal-id>
171-
AZURE_CLIENT_SECRET=<service-principal-secret>
172-
AZURE_TENANT_ID=<tenant-id>
173-
```
174-
175-
Run live tests:
176-
```bash
177-
pytest tests/ --live
178-
```
172+
Note: To run tests in playback mode instead of live mode, set:
173+
```
174+
AZURE_TEST_RUN_LIVE=false
175+
```
176+
3. Install test dependencies and the package in editable mode:
177+
```bash
178+
pip install -r dev_requirements.txt
179+
pip install -e .
180+
```
181+
182+
**Note**: If the azure-schemaregistry-avroencoder package is installed, you may encounter import errors due to issues identifying separate packages with shared namespace. To workaround this, you will need to install the client library in non-editable mode:
183+
```bash
184+
pip install .
185+
```
186+
Note: You'll need to rerun this command after making changes to the package.
187+
188+
4. Run tests:
189+
```bash
190+
# Run all tests
191+
pytest tests
192+
193+
# Run specific test
194+
pytest tests/livetest/synctests/test_queue_client.py::test_specific_function
195+
```
196+
197+
5. Updating recordings:
198+
199+
To pull test recordings from assets repo:
200+
```bash
201+
python azure-sdk-for-python/scripts/manage_recordings.py restore -p sdk/schemaregistry/azure-schemaregistry/assets.json
202+
```
203+
204+
To push after recording tests in live mode:
205+
```bash
206+
python scripts/manage_recordings.py push -p sdk/schemaregistry/azure-schemaregistry/assets.json
207+
```
179208

180209
### Common Test Issues
181210

0 commit comments

Comments
 (0)