|
28 | 28 |
|
29 | 29 | import splunklib.client as client |
30 | 30 |
|
| 31 | +import pytest |
| 32 | + |
31 | 33 |
|
32 | 34 | def highest_port(service, base_port, *kinds): |
33 | 35 | """Find the first port >= base_port not in use by any input in kinds.""" |
@@ -164,10 +166,8 @@ def test_inputs_list_on_one_kind_with_search(self): |
164 | 166 | found = [x.name for x in self.service.inputs.list('monitor', search=search)] |
165 | 167 | self.assertEqual(expected, found) |
166 | 168 |
|
| 169 | + @pytest.mark.app |
167 | 170 | def test_oneshot(self): |
168 | | - if not self.app_collection_installed(): |
169 | | - print("Test requires sdk-app-collection. Skipping.") |
170 | | - return |
171 | 171 | self.install_app_from_collection('file_to_upload') |
172 | 172 |
|
173 | 173 | index_name = testlib.tmpname() |
@@ -225,25 +225,19 @@ def test_list(self): |
225 | 225 | for input in input_list: |
226 | 226 | self.assertTrue(input.name is not None) |
227 | 227 |
|
| 228 | + @pytest.mark.app |
228 | 229 | def test_lists_modular_inputs(self): |
229 | | - if self.service.splunk_version[0] < 5: |
230 | | - print("Modular inputs don't exist prior to Splunk 5.0. Skipping.") |
231 | | - return |
232 | | - elif not self.app_collection_installed(): |
233 | | - print("Test requires sdk-app-collection. Skipping.") |
234 | | - return |
235 | | - else: |
236 | | - # Install modular inputs to list, and restart |
237 | | - # so they'll show up. |
238 | | - self.install_app_from_collection("modular-inputs") |
239 | | - self.uncheckedRestartSplunk() |
240 | | - |
241 | | - inputs = self.service.inputs |
242 | | - if ('abcd','test2') not in inputs: |
243 | | - inputs.create('abcd', 'test2', field1='boris') |
244 | | - |
245 | | - input = inputs['abcd', 'test2'] |
246 | | - self.assertEqual(input.field1, 'boris') |
| 230 | + # Install modular inputs to list, and restart |
| 231 | + # so they'll show up. |
| 232 | + self.install_app_from_collection("modular-inputs") |
| 233 | + self.uncheckedRestartSplunk() |
| 234 | + |
| 235 | + inputs = self.service.inputs |
| 236 | + if ('abcd','test2') not in inputs: |
| 237 | + inputs.create('abcd', 'test2', field1='boris') |
| 238 | + |
| 239 | + input = inputs['abcd', 'test2'] |
| 240 | + self.assertEqual(input.field1, 'boris') |
247 | 241 |
|
248 | 242 | def test_create(self): |
249 | 243 | inputs = self.service.inputs |
|
0 commit comments