Skip to content

Commit 5b39d0a

Browse files
Copilotswathipil
andcommitted
Address ServiceBus and EventHub CLIENT_DEVELOPER.md review comments
Co-authored-by: swathipil <[email protected]>
1 parent 074c141 commit 5b39d0a

File tree

2 files changed

+58
-31
lines changed

2 files changed

+58
-31
lines changed

sdk/eventhub/azure-eventhub/CLIENT_DEVELOPER.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,25 @@ Live tests require an Azure Event Hubs namespace. Resources are created dynamica
6363
```
6464

6565
2. Set required environment variables (or create a `.env` file):
66+
67+
The following need to be set to run live tests locally and authenticate with AzureCliCredential:
6668
```
69+
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
6770
EVENTHUB_RESOURCE_GROUP=<your-resource-group>
6871
EVENTHUB_NAMESPACE=<your-namespace> # Only the name, not the full URL
69-
EVENTHUB_NAME=<your-eventhub-name>
72+
AZURE_TEST_RUN_LIVE=true
73+
```
74+
75+
If using CLI:
76+
```
77+
AZURE_TEST_USE_CLI_AUTH=true
78+
```
79+
80+
OR
81+
82+
If using pwsh:
83+
```
84+
AZURE_TEST_USE_PWSH_AUTH=true
7085
```
7186

7287
3. Run tests:

sdk/servicebus/azure-servicebus/CLIENT_DEVELOPER.md

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,38 +33,43 @@ This guide is intended for developers contributing to the Azure Service Bus Pyth
3333
pip install -e .
3434
```
3535

36-
If you encounter import errors when running tests, use the standard installation:
37-
```bash
38-
pip install .
39-
```
40-
Note: You'll need to rerun this command after making changes to the package.
41-
4236
## Running Tests
4337

44-
### Unit Tests
45-
46-
Unit tests don't require any Azure resources:
47-
48-
```bash
49-
# Run all unit tests
50-
pytest tests/unittest
51-
52-
# Run specific unit test
53-
pytest tests/unittest/test_specific_file.py::test_specific_test
54-
```
55-
5638
### Live Tests
5739

58-
Live tests require an Azure Service Bus namespace. The test framework uses `ServiceBusPreparer` to create the necessary resources.
40+
Live tests require an Azure Service Bus namespace. The test framework uses `ServiceBusPreparer` to create the necessary resources for AMQP tests.
41+
42+
The tests/mgmt_tests run tests for `azure.servicebus.management` and are HTTP-based. These use the [test proxy](https://github.com/Azure/azure-sdk-for-python/blob/2e7b619b1540319aeaef2c08f3898dcc2e4ddf5c/doc/dev/tests.md#start-the-test-proxy-server).
5943

6044
1. Login to Azure:
6145
```bash
6246
az login
6347
```
6448

6549
2. Set required environment variables (or create a `.env` file):
50+
51+
The following need to be set to run live tests locally and authenticate with AzureCliCredential:
52+
```
53+
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
54+
SERVICEBUS_RESOURCE_GROUP=<your-resource-group>
55+
AZURE_TEST_RUN_LIVE=true
56+
```
57+
58+
If using CLI:
59+
```
60+
AZURE_TEST_USE_CLI_AUTH=true
61+
```
62+
63+
OR
64+
65+
If using pwsh:
6666
```
67-
SERVICEBUS_CONNECTION_STRING=<your-connection-string>
67+
AZURE_TEST_USE_PWSH_AUTH=true
68+
```
69+
70+
Note: To run mgmt tests in playback mode instead of live mode, set:
71+
```
72+
AZURE_TEST_RUN_LIVE=false
6873
```
6974

7075
3. Run tests:
@@ -79,6 +84,22 @@ Live tests require an Azure Service Bus namespace. The test framework uses `Serv
7984
pytest -s tests/livetest/synctests/test_queue_client.py::test_specific_function
8085
```
8186

87+
4. Run mgmt tests only:
88+
```bash
89+
# Review the README file for specific test setup and instructions on running tests
90+
pytest tests/mgmt_tests
91+
```
92+
93+
To pull mgmt test recordings:
94+
```bash
95+
python azure-sdk-for-python/scripts/manage_recordings.py restore -p sdk/servicebus/azure-servicebus/assets.json
96+
```
97+
98+
To push after recording mgmt tests in live mode:
99+
```bash
100+
python scripts/manage_recordings.py push -p sdk/servicebus/azure-servicebus/assets.json
101+
```
102+
82103
### Common Test Issues
83104

84105
- **Authentication errors**: If you see "The access token is invalid" errors, run `az login` to refresh your authentication.
@@ -159,20 +180,11 @@ The Performance framework helps measure performance metrics for the client libra
159180
cd tests/perfstress
160181
```
161182

162-
2. Review the README file for specific test setup:
183+
2. Review the README file for specific test setup and instructions on running tests:
163184
```bash
164185
cat README.md
165186
```
166187

167-
3. Run performance tests:
168-
```bash
169-
# Run with default options
170-
python servicebus_perf.py
171-
172-
# View available options
173-
python servicebus_perf.py --help
174-
```
175-
176188
### Running Performance Tests in Pipelines
177189

178190
- Performance test resources are deployed dynamically and specified in the service level directory's `perf-resources.bicep` file

0 commit comments

Comments
 (0)