You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/index_time_tests.rst
+84Lines changed: 84 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,6 +154,90 @@ For every test case failure, there is a defined structure for the stack trace [1
154
154
155
155
Get the search query from the stack trace and execute it on the Splunk instance and verify which specific type of events are causing failure.
156
156
157
+
158
+
FAQ
159
+
----
160
+
161
+
1. What is the source of data used while testing with pytest-splunk-addon 1.3.0 and above?
162
+
* pytest-splunk-addon relies on samples available in addon available in samples folder under path provided ``--splunk-app`` or ``--splunk-data-generator`` options.
163
+
2. When do I assign timestamp_type = event to test the time extraction (_time) for a stanza?
164
+
* When the Splunk assigns _time value from a timestamp present in event based on props configurations, you should assign ``timestamp_type=event`` for that sample stanza.
165
+
* Example:
166
+
For this sample, Splunk assigns the value ``2020-06-23T00:00:00.000Z`` to ``_time``.
In this scenario the value ``2020-06-23T00:00:00.000Z`` should be tokenized, stanza should have ``timestamp_type=event`` and the token should also have ``token.0.field = _time`` as shown below:
3. When do I assign timestamp_type = plugin to test the time extraction (_time) for a stanza?
181
+
* When there is no timestamp available in event or the props configurations are written to have the Splunk default timestamp assigned instead timestamp present in event, you should assign ``timestamp_type=plugin`` for that sample stanza.
182
+
* No _time test generates for the sample stanza when ``timestamp_type = plugin``.
183
+
* Example:
184
+
For this sample, Splunk assigns the value ``2020-06-23T00:00:00.000Z`` to ``_time``.
In this scenario, the stanza should have ``timestamp_type=plugin``.
191
+
4. When do I assign host_type = plugin for a sample stanza?
192
+
* When there are no configurations written in props to override the host value in event and Splunk default host value is assigned for host field instead of a value present in event, you should assign ``host_type=plugin`` for that sample stanza.
193
+
5. When do I assign host_type = event for a sample stanza?
194
+
* When there are some configurations written in props to override the host value for an event you should assign ``host_type=event`` for that sample stanza.
195
+
* Example:
196
+
For this sample, Splunk assigns the value sample_host to host based on the props configurations present in addon
In this scenario the value "sample_host" should be tokenized, stanza should have ``host_type=event`` and the token should also have ``token.0.field = host`` as shown below:
203
+
204
+
.. code-block:: text
205
+
206
+
token.0.token = ##host_value##
207
+
token.0.replacementType = random
208
+
token.0.replacement = host["host"]
209
+
token.0.field = host
210
+
6. Can I assign test any field present in my event as Key Field in Key Fields tests?
211
+
* No, Key Fields are defined in plugin and only below fields can be validated as part of Key Field tests.
212
+
213
+
* src
214
+
* src_port
215
+
* dest
216
+
* dest_port
217
+
* dvc
218
+
* host
219
+
* user
220
+
* url
221
+
7. What if I don't assign any field as key_field in a particular stanza even if its present in props?
222
+
* No test would generate to test Key Fields for that particular stanza and thus won't be correctly tested.
223
+
8. When do I assign token.<n>.field = <field_name> to test the Key Fields for an event?
224
+
* When there props configurations written in props to extract any of the field present in Key Fields list, you should add ``token.<n>.field = <field_name>`` to the token for that field value.
225
+
* Example:
226
+
For this sample, there is report written in props that extracts ``127.0.0.1`` as ``src``,
227
+
228
+
.. code-block:: text
229
+
230
+
2020-06-23T00:00:00.000Z test_sample_1 127.0.0.1
231
+
232
+
In this scenario the value ``127.0.0.1`` should be tokenized and the token should also have ``token.0.field = src`` as shown below:
233
+
234
+
.. code-block:: text
235
+
236
+
token.0.token = ##src_value##
237
+
token.0.replacementType = random
238
+
token.0.replacement = src["ipv4"]
239
+
token.0.field = src
240
+
157
241
------------
158
242
159
243
.. [1] Stacktrace is the text displayed in the Exception block when the Test fails.
0 commit comments