Exemplo n.º 1
0
    def test_plan(
        self,
        async_used: bool,
        caplog: LogCaptureFixture,
        fx_deployments: YamlLoaderDeployment,
        mocker: MockerFixture,
        runway_context: MockRunwayContext,
    ) -> None:
        """Test plan."""
        caplog.set_level(logging.INFO, logger="runway")
        mock_async = MagicMock()
        mocker.patch.object(Deployment, "_Deployment__async", mock_async)
        mock_sync = MagicMock()
        mocker.patch.object(Deployment, "_Deployment__sync", mock_sync)
        runway_context._use_concurrent = async_used
        obj = Deployment(
            context=runway_context,
            definition=fx_deployments.load("simple_parallel_regions"),
        )
        assert obj.plan()

        if async_used:
            assert ("unnamed_deployment:processing of regions will be done in "
                    "parallel during deploy/destroy" in caplog.messages)
        mock_async.assert_not_called()
        mock_sync.assert_called_once_with("plan")
Exemplo n.º 2
0
    def test_plan(
        self, async_used, caplog, fx_deployments, monkeypatch, runway_context
    ):
        """Test plan."""
        caplog.set_level(logging.INFO, logger="runway")
        mock_async = MagicMock()
        monkeypatch.setattr(Deployment, "_Deployment__async", mock_async)
        mock_sync = MagicMock()
        monkeypatch.setattr(Deployment, "_Deployment__sync", mock_sync)
        runway_context._use_concurrent = async_used
        obj = Deployment(
            context=runway_context,
            definition=fx_deployments.load("simple_parallel_regions"),
        )
        assert obj.plan()

        if async_used:
            assert (
                "deployment_1:processing of regions will be done in "
                "parallel during deploy/destroy" in caplog.messages
            )
        mock_async.assert_not_called()
        mock_sync.assert_called_once_with("plan")