Skip to content

Flaky integration test: test_nativeapp_force_cross_upgrade[run_args_from6-run_args_to6-napp_init_v2] #2374

@github-actions

Description

@github-actions

Nodeid: tests_integration/nativeapp/test_init_run.py::test_nativeapp_force_cross_upgrade[run_args_from6-run_args_to6-napp_init_v2]

🟢 Setup passed

🔴 Call failed

[gw2] win32 -- Python 3.10.11 C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\Scripts\python.EXE

self = <snowflake.cli._plugins.nativeapp.sf_sql_facade.SnowflakeSQLFacade object at 0x000001B0D76F3D00>
name = 'myapp_snowflake_8886adf07bd548c0843133a1040b6d19_test_nativeapp_force_cross_upgrade'
package_name = 'myapp_pkg_snowflake_8886adf07bd548c0843133a1040b6d19_test_nativeapp_force_cross_upgrade'
install_method = SameAccountInstallMethod(_requires_created_by_cli=False, version=None, patch=None, _from_release_directive=True)
path_to_version_directory = 'myapp_pkg_snowflake_8886adf07bd548c0843133a1040b6d19_test_nativeapp_force_cross_upgrade.app_src.stage'
role = 'INTEGRATION_TESTS', warehouse = 'XSMALL', debug_mode = None
should_authorize_event_sharing = None, release_channel = None

    def create_application(
        self,
        name: str,
        package_name: str,
        install_method: SameAccountInstallMethod,
        path_to_version_directory: str,
        role: str,
        warehouse: str,
        debug_mode: bool | None,
        should_authorize_event_sharing: bool | None,
        release_channel: str | None = None,
    ) -> tuple[list[tuple[str]], list[str]]:
        """
        Creates a new application object using an application package,
        running the setup script of the application package
    
        @param name: Name of the application object
        @param package_name: Name of the application package to install the application from
        @param install_method: Method of installing the application
        @param path_to_version_directory: Path to directory in stage housing the application artifacts
        @param role: Role to use when creating the application and provider-side objects
        @param warehouse: Warehouse which is required to create an application object
        @param debug_mode: Whether to enable debug mode; None means not explicitly enabled or disabled
        @param should_authorize_event_sharing: Whether to enable event sharing; None means not explicitly enabled or disabled
        @param release_channel [Optional]: Release channel to use when creating the application
        @return: a tuple containing the result of the create application query and possible warning messages
        """
        package_name = to_identifier(package_name)
        name = to_identifier(name)
        release_channel = to_identifier(release_channel) if release_channel else None
    
        # by default, applications are created in debug mode when possible;
        # this can be overridden in the project definition
        initial_debug_mode = False
        if install_method.is_dev_mode:
            initial_debug_mode = debug_mode if debug_mode is not None else True
        authorize_telemetry_clause = ""
        if should_authorize_event_sharing is not None:
            self._log.info(
                "Setting AUTHORIZE_TELEMETRY_EVENT_SHARING to %s",
                should_authorize_event_sharing,
            )
            authorize_telemetry_clause = f"AUTHORIZE_TELEMETRY_EVENT_SHARING = {str(should_authorize_event_sharing).upper()}"
    
        using_clause = install_method.using_clause(path_to_version_directory)
        release_channel_clause = (
            f"using release channel {release_channel}" if release_channel else ""
        )
    
        with self._use_role_optional(role), self._use_warehouse_optional(warehouse):
            try:
>               create_cursor = self._sql_executor.execute_query(
                    dedent(
                        _strip_empty_lines(
                            f"""\
                                create application {name}
                                    from application package {package_name}
                                    {using_clause}
                                    {release_channel_clause}
                                    {authorize_telemetry_clause}
                                    comment = {SPECIAL_COMMENT}
                            """
                        )
                    ),
                )

D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\nativeapp\sf_sql_facade.py:903: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\sql_execution.py:100: in execute_query
    *_, last_result = list(self.execute_string(query, **kwargs))
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\snowflake\connector\connection.py:1035: in execute_stream
    cur.execute(sql, _is_put_get=is_put_or_get, **kwargs)
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\snowflake\connector\cursor.py:1134: in execute
    Error.errorhandler_wrapper(self.connection, self, error_class, errvalue)
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\snowflake\connector\errors.py:279: in errorhandler_wrapper
    handed_over = Error.hand_to_other_handler(
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\snowflake\connector\errors.py:334: in hand_to_other_handler
    cursor.errorhandler(connection, cursor, error_class, error_value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

connection = <snowflake.connector.connection.SnowflakeConnection object at 0x000001B0D7ADFE80>
cursor = <snowflake.connector.cursor.SnowflakeCursor object at 0x000001B0D5EC17B0>
error_class = <class 'snowflake.connector.errors.ProgrammingError'>
error_value = {'done_format_msg': False, 'errno': 603, 'msg': 'SQL execution internal error:\nProcessing aborted due to error 300002...ake_8886adf07bd548c0843133a1040b6d19_test_nativeapp_force_cross_upgrade\n    comment = GENERATED_BY_SNOWFLAKECLI', ...}

    @staticmethod
    def default_errorhandler(
        connection: SnowflakeConnection,
        cursor: SnowflakeCursor,
        error_class: type[Error],
        error_value: dict[str, str],
    ) -> None:
        """Default error handler that raises an error.
    
        Args:
            connection: Connections in which the error happened.
            cursor: Cursor in which the error happened.
            error_class: Class of error that needs handling.
            error_value: A dictionary of the error details.
    
        Raises:
            A Snowflake error.
        """
        errno = error_value.get("errno")
        done_format_msg = error_value.get("done_format_msg")
>       raise error_class(
            msg=error_value.get("msg"),
            errno=None if errno is None else int(errno),
            sqlstate=error_value.get("sqlstate"),
            sfqid=error_value.get("sfqid"),
            query=error_value.get("query"),
            done_format_msg=(
                None if done_format_msg is None else bool(done_format_msg)
            ),
            connection=connection,
            cursor=cursor,
        )
E       snowflake.connector.errors.ProgrammingError: 000603 (XX000): 01bce8fa-0e10-4b3f-0001-c1be1651b8d2: SQL execution internal error:
E       Processing aborted due to error 300002:2865958091; incident 7373790.

C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\snowflake\connector\errors.py:210: ProgrammingError

The above exception was the direct cause of the following exception:

test_project = 'napp_init_v2'
nativeapp_project_directory = <function nativeapp_project_directory.<locals>._nativeapp_project_directory at 0x000001B0D60AA5F0>
run_args_from = ['--from-release-directive'], run_args_to = []
runner = <tests_integration.conftest.SnowCLIRunner object at 0x000001B0D7CA8B80>
default_username = 'snowflake'
resource_suffix = '_8886adf07bd548c0843133a1040b6d19_test_nativeapp_force_cross_upgrade'

    @pytest.mark.integration
    @pytest.mark.parametrize("test_project", ["napp_init_v2"])
    @pytest.mark.parametrize(
        "run_args_from, run_args_to",
        [
            ([], []),
            ([], ["--version", "v1"]),
            ([], ["--from-release-directive"]),
            (["--version", "v1"], []),
            (["--version", "v1"], ["--version", "v1"]),
            (["--version", "v1"], ["--from-release-directive"]),
            (["--from-release-directive"], []),
            (["--from-release-directive"], ["--version", "v1"]),
            (["--from-release-directive"], ["--from-release-directive"]),
        ],
    )
    def test_nativeapp_force_cross_upgrade(
        test_project,
        nativeapp_project_directory,
        run_args_from,
        run_args_to,
        runner,
        default_username,
        resource_suffix,
    ):
        project_name = "myapp"
        app_name = f"{project_name}_{default_username}{resource_suffix}"
        pkg_name = f"{project_name}_pkg_{default_username}{resource_suffix}"
    
        with nativeapp_project_directory(test_project):
            # Create version
            result = runner.invoke_with_connection(["app", "version", "create", "v1"])
            assert result.exit_code == 0
    
            # Set default release directive
            result = runner.invoke_with_connection(
                [
                    "sql",
                    "-q",
                    f"alter application package {pkg_name} set default release directive version = v1 patch = 0",
                ]
            )
            assert result.exit_code == 0
    
            # Initial run
>           result = runner.invoke_with_connection(["app", "run"] + run_args_from)

D:\a\snowflake-cli\snowflake-cli\tests_integration\nativeapp\test_init_run.py:542: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\snowflake-cli\snowflake-cli\tests_integration\conftest.py:188: in invoke_with_connection
    return self.invoke_with_config([*args, "-c", connection], **kwargs)
D:\a\snowflake-cli\snowflake-cli\tests_integration\conftest.py:159: in invoke_with_config
    result = self.invoke(
D:\a\snowflake-cli\snowflake-cli\tests_integration\conftest.py:132: in invoke
    return super().invoke(self.app, *a, **kw)
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\typer\testing.py:21: in invoke
    return super().invoke(
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\click\testing.py:412: in invoke
    return_value = cli.main(args=args or (), prog_name=prog_name, **extra)
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\typer\core.py:757: in main
    return _main(
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\typer\core.py:195: in _main
    rv = self.invoke(ctx)
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\click\core.py:1697: in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\click\core.py:1697: in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\click\core.py:1443: in invoke
    return ctx.invoke(self.callback, **ctx.params)
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\click\core.py:788: in invoke
    return __callback(*args, **kwargs)
C:\Users\runneradmin\AppData\Local\hatch\env\virtual\snowflake-cli\EHYzLnPj\integration\lib\site-packages\typer\main.py:699: in wrapper
    return callback(**use_params)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\commands\snow_typer.py:129: in command_callable_decorator
    raise exception
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\commands\snow_typer.py:123: in command_callable_decorator
    result = command_callable(*args, **kw)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\commands\decorators.py:171: in wrapper
    return func(**options)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\commands\decorators.py:171: in wrapper
    return func(**options)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\commands\decorators.py:171: in wrapper
    return func(**options)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\nativeapp\v2_conversions\compat.py:228: in wrapper
    return func(*args, **kwargs)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\nativeapp\commands.py:172: in app_run
    ws.perform_action(
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\workspace\manager.py:62: in perform_action
    return entity.perform(action, self.action_ctx, *args, **kwargs)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\entities\common.py:85: in perform
    return getattr(self, action)(action_ctx, *args, **kwargs)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\cli_global_context.py:252: in wrapper
    return func(*args, **kwargs)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\nativeapp\entities\application.py:364: in action_deploy
    self.create_or_upgrade_app(
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\api\cli_global_context.py:252: in wrapper
    return func(*args, **kwargs)
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\nativeapp\entities\application.py:723: in create_or_upgrade_app
    create_or_upgrade_result = self._create_app(
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\nativeapp\entities\application.py:672: in _create_app
    create_app_result, warnings = get_snowflake_facade().create_application(
D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\nativeapp\sf_sql_facade.py:936: in create_application
    handle_unclassified_error(err, f"Failed to create application {name}.")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

err = 000603 (XX000): 01bce8fa-0e10-4b3f-0001-c1be1651b8d2: SQL execution internal error:
Processing aborted due to error 300002:2865958091; incident 7373790.
context = 'Failed to create application myapp_snowflake_8886adf07bd548c0843133a1040b6d19_test_nativeapp_force_cross_upgrade.'

    def handle_unclassified_error(err: Error | Exception, context: str) -> NoReturn:
        """
        Handles exceptions that are not caught by categorized exceptions in SQLFacade
        @param err: connector error or base exception
        @param context: message to add context to exception
        """
        message = f"{context} {str(err)}"
        if isinstance(err, ProgrammingError):
>           raise InvalidSQLError(message) from err
E           snowflake.cli._plugins.nativeapp.sf_facade_exceptions.InvalidSQLError: Invalid SQL error occurred. Failed to create application myapp_snowflake_8886adf07bd548c0843133a1040b6d19_test_nativeapp_force_cross_upgrade. 000603 (XX000): 01bce8fa-0e10-4b3f-0001-c1be1651b8d2: SQL execution internal error:
E           Processing aborted due to error 300002:2865958091; incident 7373790.

D:\a\snowflake-cli\snowflake-cli\src\snowflake\cli\_plugins\nativeapp\sf_facade_exceptions.py:100: InvalidSQLError

raise InvalidSQLError(message) from err

🟢 Teardown passed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions