Pulsar
Fixtures
pytest_streaming.pulsar.fixtures
Functions:
Name | Description |
---|---|
streaming_pulsar_marker |
Usable PulsarMarker object |
streaming_pulsar_client |
Raw pulsar client using the service url configured for the given test. |
streaming_pulsar_consumer |
Raw pulsar consumer using the topics configured for the given test. Yields a unique subscription name each time. |
streaming_pulsar_producers |
Raw pulsar producer using the topics configured for the given test. |
streaming_pulsar_marker(request, pytestconfig)
Usable PulsarMarker object
Yields the base pulsar marker object that gives you access to the designated configurations for the individual test. See PulsarMarker specification.
Example
Returns:
Name | Type | Description |
---|---|---|
PulsarMarker |
PulsarMarker
|
object with all of the defined user configurations |
Source code in pytest_streaming/pulsar/fixtures.py
streaming_pulsar_client(streaming_pulsar_marker)
Raw pulsar client using the service url configured for the given test.
Does all of the necessary cleanup for you after the test concludes.
Example
Returns:
Type | Description |
---|---|
Generator[Client, None]
|
pulsar.Client: raw pulsar client from the base pulsar library |
Source code in pytest_streaming/pulsar/fixtures.py
streaming_pulsar_consumer(streaming_pulsar_client, streaming_pulsar_marker)
Raw pulsar consumer using the topics configured for the given test. Yields a unique subscription name each time.
Does all of the necessary cleanup for you after the test concludes.
Example
Returns:
Type | Description |
---|---|
Generator[Consumer, None]
|
pulsar.Consumer: raw pulsar consumer from the base pulsar library |
Source code in pytest_streaming/pulsar/fixtures.py
streaming_pulsar_producers(streaming_pulsar_client, streaming_pulsar_marker)
Raw pulsar producer using the topics configured for the given test.
Does all of the necessary cleanup for you after the test concludes.
Example
Returns:
Type | Description |
---|---|
Generator[dict[str, Producer], None]
|
dict[topic.name, pulsar.Producer]: raw pulsar producers from the base pulsar library |
Source code in pytest_streaming/pulsar/fixtures.py
Markers
pytest_streaming.pulsar.markers.PulsarMarker
Bases: BaseMarker
Primary pulsar marker for working with Pulsar topics.
This marker allows you to create and delete Pulsar topics for testing purposes. It ensures the specified tenant and namespace exist before creating topics. By default, topics are recreated if they already exist.
Attributes:
Name | Type | Description |
---|---|---|
- |
marker_name (str
|
name of the marker |
- |
marker_description (str
|
description of the marker |
- |
topics (list[str]
|
A list of Pulsar topic names to create. |
- |
delete_after (bool
|
If True, the topics will be deleted after the test. (default: False) |
- |
service_url (str
|
The Pulsar service URL. (default: from pytest.ini or Defaults.PULSAR_SERVICE_URL) |
- |
admin_url (str
|
The pulsar admin URL (default: from pytest.ini or Defaults.PULSAR_ADMIN_URL) |
Required Parameters
- topics (list[str])
Optional Parameters
- delete_after (bool)
- service_url (str)
- admin_url (str)
Example
Source code in pytest_streaming/pulsar/markers.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|