Skip to content

chore(deps): lock file maintenance #1294

chore(deps): lock file maintenance

chore(deps): lock file maintenance #1294

GitHub Actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account failed Sep 26, 2024 in 1s

0 passed, 60 failed and 1 skipped

Tests failed

❌ test-results/junit.xml

61 tests were completed in 25s with 0 passed, 60 failed and 1 skipped.

Test suite Passed Failed Skipped Time
pytest 60❌ 1⚪ 25s

❌ pytest

test_splunk_ta_example_addon_account.chrome_TestAccount
  ❌ test_account_default_rows_in_table
	request = <SubRequest 'splunk' for <Function test_account_default_rows_in_table>>
  ❌ test_account_sort_functionality
	request = <SubRequest 'splunk' for <Function test_account_sort_functionality>>
  ❌ test_account_count
	request = <SubRequest 'splunk' for <Function test_account_count>>
  ❌ test_accounts_filter_functionality_negative
	request = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_negative>>
  ❌ test_accounts_filter_functionality_positive
	request = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_positive>>
  ❌ test_account_pagination
	request = <SubRequest 'splunk' for <Function test_account_pagination>>
  ❌ test_account_title_and_description
	request = <SubRequest 'splunk' for <Function test_account_title_and_description>>
  ❌ test_account_add_valid_title
	request = <SubRequest 'splunk' for <Function test_account_add_valid_title>>
  ❌ test_account_edit_valid_title
	request = <SubRequest 'splunk' for <Function test_account_edit_valid_title>>
  ❌ test_account_clone_valid_title
	request = <SubRequest 'splunk' for <Function test_account_clone_valid_title>>
  ❌ test_account_delete_valid_title
	request = <SubRequest 'splunk' for <Function test_account_delete_valid_title>>
  ❌ test_account_add_close_entity
	request = <SubRequest 'splunk' for <Function test_account_add_close_entity>>
  ❌ test_account_add_cancel_entity
	request = <SubRequest 'splunk' for <Function test_account_add_cancel_entity>>
  ❌ test_account_delete_close_entity
	request = <SubRequest 'splunk' for <Function test_account_delete_close_entity>>
  ❌ test_account_delete_cancel_entity
	request = <SubRequest 'splunk' for <Function test_account_delete_cancel_entity>>
  ❌ test_account_edit_close_entity
	request = <SubRequest 'splunk' for <Function test_account_edit_close_entity>>
  ❌ test_account_edit_cancel_entity
	request = <SubRequest 'splunk' for <Function test_account_edit_cancel_entity>>
  ❌ test_account_clone_close_entity
	request = <SubRequest 'splunk' for <Function test_account_clone_close_entity>>
  ❌ test_account_clone_cancel_entity
	request = <SubRequest 'splunk' for <Function test_account_clone_cancel_entity>>
  ❌ test_account_delete_valid_prompt_message
	request = <SubRequest 'splunk' for <Function test_account_delete_valid_prompt_message>>
  ❌ test_account_required_field_username
	request = <SubRequest 'splunk' for <Function test_account_required_field_username>>
  ❌ test_account_required_field_password
	request = <SubRequest 'splunk' for <Function test_account_required_field_password>>
  ❌ test_account_encrypted_field_password
	request = <SubRequest 'splunk' for <Function test_account_encrypted_field_password>>
  ❌ test_account_required_field_name
	request = <SubRequest 'splunk' for <Function test_account_required_field_name>>
  ❌ test_account_required_field_example_file
	request = <SubRequest 'splunk' for <Function test_account_required_field_example_file>>
  ❌ test_account_example_file_validations
	request = <SubRequest 'splunk' for <Function test_account_example_file_validations>>
  ❌ test_account_basic_fields_label_entity
	request = <SubRequest 'splunk' for <Function test_account_basic_fields_label_entity>>
  ❌ test_account_oauth_fields_label_entity
	request = <SubRequest 'splunk' for <Function test_account_oauth_fields_label_entity>>
  ❌ test_account_help_text_entity
	request = <SubRequest 'splunk' for <Function test_account_help_text_entity>>
  ⚪ test_account_required_field_example_environment
  ❌ test_account_required_field_example_multiple_select
	request = <SubRequest 'splunk' for <Function test_account_required_field_example_multiple_select>>
  ❌ test_account_required_field_client_id
	request = <SubRequest 'splunk' for <Function test_account_required_field_client_id>>
  ❌ test_account_required_field_client_secret
	request = <SubRequest 'splunk' for <Function test_account_required_field_client_secret>>
  ❌ test_account_encrypted_field_client_secret
	request = <SubRequest 'splunk' for <Function test_account_encrypted_field_client_secret>>
  ❌ test_account_valid_account_name
	request = <SubRequest 'splunk' for <Function test_account_valid_account_name>>
  ❌ test_account_valid_length_name
	request = <SubRequest 'splunk' for <Function test_account_valid_length_name>>
  ❌ test_account_default_value_example_environment
	request = <SubRequest 'splunk' for <Function test_account_default_value_example_environment>>
  ❌ test_account_list_example_environment
	request = <SubRequest 'splunk' for <Function test_account_list_example_environment>>
  ❌ test_account_default_value_auth_type
	request = <SubRequest 'splunk' for <Function test_account_default_value_auth_type>>
  ❌ test_account_list_auth_type
	request = <SubRequest 'splunk' for <Function test_account_list_auth_type>>
  ❌ test_account_checked_example_checkbox
	request = <SubRequest 'splunk' for <Function test_account_checked_example_checkbox>>
  ❌ test_account_select_value_example_environment
	request = <SubRequest 'splunk' for <Function test_account_select_value_example_environment>>
  ❌ test_account_list_example_multiple_select
	request = <SubRequest 'splunk' for <Function test_account_list_example_multiple_select>>
  ❌ test_account_select_value_example_multiple_select
	request = <SubRequest 'splunk' for <Function test_account_select_value_example_multiple_select>>
  ❌ test_account_search_value_example_multiple_select
	request = <SubRequest 'splunk' for <Function test_account_search_value_example_multiple_select>>
  ❌ test_account_default_value_example_radio
	request = <SubRequest 'splunk' for <Function test_account_default_value_example_radio>>
  ❌ test_add_account_duplicate_name
	request = <SubRequest 'splunk' for <Function test_add_account_duplicate_name>>
  ❌ test_account_delete_row_frontend_validation
	request = <SubRequest 'splunk' for <Function test_account_delete_row_frontend_validation>>
  ❌ test_account_edit_uneditable_field_name
	request = <SubRequest 'splunk' for <Function test_account_edit_uneditable_field_name>>
  ❌ test_account_credentials_encrypted_value
	request = <SubRequest 'splunk' for <Function test_account_credentials_encrypted_value>>
  ❌ test_account_add_frontend_validation
	request = <SubRequest 'splunk' for <Function test_account_add_frontend_validation>>
  ❌ test_account_edit_frontend_validation
	request = <SubRequest 'splunk' for <Function test_account_edit_frontend_validation>>
  ❌ test_clone_account_duplicate_name
	request = <SubRequest 'splunk' for <Function test_clone_account_duplicate_name>>
  ❌ test_account_clone_frontend_validation
	request = <SubRequest 'splunk' for <Function test_account_clone_frontend_validation>>
  ❌ test_account_clone_default_values
	request = <SubRequest 'splunk' for <Function test_account_clone_default_values>>
  ❌ test_account_add_backend_validation
	request = <SubRequest 'splunk' for <Function test_account_add_backend_validation>>
  ❌ test_account_edit_backend_validation
	request = <SubRequest 'splunk' for <Function test_account_edit_backend_validation>>
  ❌ test_account_clone_backend_validation
	request = <SubRequest 'splunk' for <Function test_account_clone_backend_validation>>
  ❌ test_account_delete_row_backend_validation
	request = <SubRequest 'splunk' for <Function test_account_delete_row_backend_validation>>
  ❌ test_account_helplink
	request = <SubRequest 'splunk' for <Function test_account_helplink>>
  ❌ test_account_delete_account_in_use
	request = <SubRequest 'splunk' for <Function test_account_delete_account_in_use>>

Annotations

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_default_rows_in_table

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_default_rows_in_table>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_default_rows_in_table>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_default_rows_in_table>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_default_rows_in_table>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_default_rows_in_table>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_default_rows_in_table>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_sort_functionality

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_sort_functionality>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_sort_functionality>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_sort_functionality>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_sort_functionality>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_sort_functionality>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_sort_functionality>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_sort_functionality>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_count

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_count>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_count>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_count>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_count>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_count>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_count>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_count>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_accounts_filter_functionality_negative

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_negative>>
Raw output
request = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_negative>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_negative>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_negative>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_negative>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_accounts_filter_functionality_negative>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_negative>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_accounts_filter_functionality_positive

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_positive>>
Raw output
request = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_positive>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_positive>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_positive>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_positive>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_accounts_filter_functionality_positive>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_accounts_filter_functionality_positive>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_pagination

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_pagination>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_pagination>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_pagination>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_pagination>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_pagination>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_pagination>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_pagination>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_title_and_description

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_title_and_description>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_title_and_description>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_title_and_description>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_title_and_description>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_title_and_description>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_title_and_description>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_title_and_description>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_add_valid_title

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_add_valid_title>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_add_valid_title>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_add_valid_title>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_add_valid_title>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_add_valid_title>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_add_valid_title>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_add_valid_title>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_edit_valid_title

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_edit_valid_title>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_edit_valid_title>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_edit_valid_title>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_edit_valid_title>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_edit_valid_title>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_edit_valid_title>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_edit_valid_title>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_clone_valid_title

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_clone_valid_title>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_clone_valid_title>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_clone_valid_title>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_clone_valid_title>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_clone_valid_title>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_clone_valid_title>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_clone_valid_title>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception

Check failure on line 0 in test-results/junit.xml

See this annotation in the file changed.

@github-actions github-actions / test-report-9.1.1__chrome_test_splunk_ta_example_addon_account

pytest ► test_splunk_ta_example_addon_account.chrome_TestAccount ► test_account_delete_valid_title

Failed test found in:
  test-results/junit.xml
Error:
  request = <SubRequest 'splunk' for <Function test_account_delete_valid_title>>
Raw output
request = <SubRequest 'splunk' for <Function test_account_delete_valid_title>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
>           splunk_info = request.getfixturevalue(splunk_fixture)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:440: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_delete_valid_title>>
argname = 'splunk_external'

    def getfixturevalue(self, argname: str) -> Any:
        """Dynamically run a named fixture function.
    
        Declaring fixtures via function argument is recommended where possible.
        But if you can only decide whether to use another fixture at test
        setup time, you may use this function to retrieve it inside a fixture
        or test function body.
    
        This method can be used during the test setup phase or the test run
        phase, but during the test teardown phase a fixture's value may not
        be available.
    
        :param argname:
            The fixture name.
        :raises pytest.FixtureLookupError:
            If the given fixture could not be found.
        """
>       fixturedef = self._get_active_fixturedef(argname)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:569: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_delete_valid_title>>
argname = 'splunk_external'

    def _get_active_fixturedef(
        self, argname: str
    ) -> Union["FixtureDef[object]", PseudoFixtureDef[object]]:
        try:
            return self._fixture_defs[argname]
        except KeyError:
            try:
                fixturedef = self._getnextfixturedef(argname)
            except FixtureLookupError:
                if argname == "request":
                    cached_result = (self, [0], None)
                    return PseudoFixtureDef(cached_result, Scope.Function)
                raise
        # Remove indent to prevent the python3 exception
        # from leaking into the call.
>       self._compute_fixture_value(fixturedef)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <SubRequest 'splunk' for <Function test_account_delete_valid_title>>
fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>

    def _compute_fixture_value(self, fixturedef: "FixtureDef[object]") -> None:
        """Create a SubRequest based on "self" and call the execute method
        of the given FixtureDef object.
    
        This will force the FixtureDef object to throw away any previous
        results and compute a new fixture value, which will be stored into
        the FixtureDef object itself.
        """
        # prepare a subrequest object before calling fixture function
        # (latter managed by fixturedef)
        argname = fixturedef.argname
        funcitem = self._pyfuncitem
        scope = fixturedef._scope
        try:
            callspec = funcitem.callspec
        except AttributeError:
            callspec = None
        if callspec is not None and argname in callspec.params:
            param = callspec.params[argname]
            param_index = callspec.indices[argname]
            # If a parametrize invocation set a scope it will override
            # the static scope defined with the fixture function.
            with suppress(KeyError):
                scope = callspec._arg2scope[argname]
        else:
            param = NOTSET
            param_index = 0
            has_params = fixturedef.params is not None
            fixtures_not_supported = getattr(funcitem, "nofuncargs", False)
            if has_params and fixtures_not_supported:
                msg = (
                    "{name} does not support fixtures, maybe unittest.TestCase subclass?\n"
                    "Node id: {nodeid}\n"
                    "Function type: {typename}"
                ).format(
                    name=funcitem.name,
                    nodeid=funcitem.nodeid,
                    typename=type(funcitem).__name__,
                )
                fail(msg, pytrace=False)
            if has_params:
                frame = inspect.stack()[3]
                frameinfo = inspect.getframeinfo(frame[0])
                source_path = absolutepath(frameinfo.filename)
                source_lineno = frameinfo.lineno
                try:
                    source_path_str = str(
                        source_path.relative_to(funcitem.config.rootpath)
                    )
                except ValueError:
                    source_path_str = str(source_path)
                msg = (
                    "The requested fixture has no parameter defined for test:\n"
                    "    {}\n\n"
                    "Requested fixture '{}' defined in:\n{}"
                    "\n\nRequested here:\n{}:{}".format(
                        funcitem.nodeid,
                        fixturedef.argname,
                        getlocation(fixturedef.func, funcitem.config.rootpath),
                        source_path_str,
                        source_lineno,
                    )
                )
                fail(msg, pytrace=False)
    
        subrequest = SubRequest(
            self, scope, param, param_index, fixturedef, _ispytest=True
        )
    
        # Check if a higher-level scoped fixture accesses a lower level one.
        subrequest._check_scope(argname, self._scope, scope)
        try:
            # Call the fixture function.
>           fixturedef.execute(request=subrequest)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:677: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_delete_valid_title>>

    def execute(self, request: SubRequest) -> FixtureValue:
        # Get required arguments and register our own finish()
        # with their finalization.
        for argname in self.argnames:
            fixturedef = request._get_active_fixturedef(argname)
            if argname != "request":
                # PseudoFixtureDef is only for "request".
                assert isinstance(fixturedef, FixtureDef)
                fixturedef.addfinalizer(functools.partial(self.finish, request=request))
    
        my_cache_key = self.cache_key(request)
        if self.cached_result is not None:
            # note: comparison with `==` can fail (or be expensive) for e.g.
            # numpy arrays (#6497).
            cache_key = self.cached_result[1]
            if my_cache_key is cache_key:
                if self.cached_result[2] is not None:
                    _, val, tb = self.cached_result[2]
>                   raise val.with_traceback(tb)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1065: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturedef = <FixtureDef argname='splunk_external' scope='session' baseid=''>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    def pytest_fixture_setup(
        fixturedef: FixtureDef[FixtureValue], request: SubRequest
    ) -> FixtureValue:
        """Execution of fixture setup."""
        kwargs = {}
        for argname in fixturedef.argnames:
            fixdef = request._get_active_fixturedef(argname)
            assert fixdef.cached_result is not None
            result, arg_cache_key, exc = fixdef.cached_result
            request._check_scope(argname, request._scope, fixdef._scope)
            kwargs[argname] = result
    
        fixturefunc = resolve_fixture_function(fixturedef, request)
        my_cache_key = fixturedef.cache_key(request)
        try:
>           result = call_fixture_func(fixturefunc, request, kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:1129: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

fixturefunc = <function splunk_external at 0x7f69fb87b680>
request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
kwargs = {'request': <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>}

    def call_fixture_func(
        fixturefunc: "_FixtureFunc[FixtureValue]", request: FixtureRequest, kwargs
    ) -> FixtureValue:
        if is_generator(fixturefunc):
            fixturefunc = cast(
                Callable[..., Generator[FixtureValue, None, None]], fixturefunc
            )
            generator = fixturefunc(**kwargs)
            try:
                fixture_result = next(generator)
            except StopIteration:
                raise ValueError(f"{request.fixturename} did not yield a value") from None
            finalizer = functools.partial(_teardown_yield_fixture, fixturefunc, generator)
            request.addfinalizer(finalizer)
        else:
            fixturefunc = cast(Callable[..., FixtureValue], fixturefunc)
>           fixture_result = fixturefunc(**kwargs)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/fixtures.py:908: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>

    @pytest.fixture(scope="session")
    def splunk_external(request):
        """
        This fixture provides the connection properties to Splunk based on the pytest args
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_info = {
            "port_hec": request.config.getoption("splunk_hec"),
            "port_s2s": request.config.getoption("splunk_s2s"),
            "port_web": request.config.getoption("splunk_web"),
            "host": request.config.getoption("splunk_host"),
            "port": request.config.getoption("splunkd_port"),
            "username": request.config.getoption("splunk_user"),
            "password": request.config.getoption("splunk_password"),
        }
        if not request.config.getoption("splunk_forwarder_host"):
            splunk_info["forwarder_host"] = splunk_info.get("host")
        else:
            splunk_info["forwarder_host"] = request.config.getoption(
                "splunk_forwarder_host"
            )
    
        for _ in range(RESPONSIVE_SPLUNK_TIMEOUT):
            if is_responsive_splunk(splunk_info) and is_responsive_hec(
                request, splunk_info
            ):
                break
            sleep(1)
    
        if not is_responsive_splunk(splunk_info):
            raise Exception(
                "Could not connect to the external Splunk Instance"
                "Please check the log file for possible errors."
            )
        if not is_responsive_hec(request, splunk_info):
            raise Exception(
                "Could not connect to Splunk HEC"
                "Please check the log file for possible errors."
            )
>       is_valid_hec(request, splunk_info)

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:642: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

request = <SubRequest 'splunk_external' for <Function test_account_default_rows_in_table>>
splunk = {'forwarder_host': 'localhost', 'host': 'localhost', 'password': 'Chang3d!', 'port': '8089', ...}

    def is_valid_hec(request, splunk):
        """
        Verify if provided hec token is valid by sending simple post request.
    
        Args:
            splunk (dict): details of the Splunk instance
    
        Returns:
            None
        """
    
        LOGGER.info(
            "Validating HEC token...  splunk=%s",
            json.dumps(splunk),
        )
        response = requests.post(
            url=f'{request.config.getoption("splunk_hec_scheme")}://{splunk["forwarder_host"]}:{splunk["port_hec"]}/services/collector/raw',
            headers={
                "Authorization": f'Splunk {request.config.getoption("splunk_hec_token")}'
            },
            data={"event": "test_hec", "sourcetype": "hec_token_test"},
            verify=False,
        )
        LOGGER.debug("Status code: %d", response.status_code)
    
        if response.status_code == 200:
            LOGGER.info("Splunk HEC is valid.")
        else:
>           pytest.exit("Exiting pytest due to invalid HEC token value.")

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:1048: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

reason = 'Exiting pytest due to invalid HEC token value.', returncode = None

    @_with_exception(Exit)
    def exit(
        reason: str = "", returncode: Optional[int] = None, *, msg: Optional[str] = None
    ) -> NoReturn:
        """Exit testing process.
    
        :param reason:
            The message to show as the reason for exiting pytest.  reason has a default value
            only because `msg` is deprecated.
    
        :param returncode:
            Return code to be used when exiting pytest.
    
        :param msg:
            Same as ``reason``, but deprecated. Will be removed in a future version, use ``reason`` instead.
        """
        __tracebackhide__ = True
        from _pytest.config import UsageError
    
        if reason and msg:
            raise UsageError(
                "cannot pass reason and msg to exit(), `msg` is deprecated, use `reason`."
            )
        if not reason:
            if msg is None:
                raise UsageError("exit() requires a reason argument")
            warnings.warn(KEYWORD_MSG_ARG.format(func="exit"), stacklevel=2)
            reason = msg
>       raise Exit(reason, returncode)
E       _pytest.outcomes.Exit: Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/_pytest/outcomes.py:143: Exit

During handling of the above exception, another exception occurred:

request = <SubRequest 'splunk' for <Function test_account_delete_valid_title>>
file_system_prerequisite = None

    @pytest.fixture(scope="session")
    def splunk(request, file_system_prerequisite):
        """
        This fixture based on the passed option will provide a real fixture
        for external or docker Splunk
    
        Returns:
            dict: Details of the splunk instance including host, port, username & password.
        """
        splunk_type = request.config.getoption("splunk_type")
        LOGGER.info("Get the Splunk instance of splunk_type=%s", splunk_type)
        splunk_fixture = f"splunk_{splunk_type}"
        try:
            request.fixturenames.append(splunk_fixture)
            splunk_info = request.getfixturevalue(splunk_fixture)
        except Exception as e:
>           raise Exception(f"Failed to get Splunk fixture ({splunk_fixture}): {e}")
E           Exception: Failed to get Splunk fixture (splunk_external): Exiting pytest due to invalid HEC token value.

../../../.cache/pypoetry/virtualenvs/pytest-splunk-addon-ui-smartx-Ww8IZlvF-py3.7/lib/python3.7/site-packages/pytest_splunk_addon/splunk.py:442: Exception