While a lambda is still processing (archive unpacking etc), the lambda state should be set to "Pending" (currently "Active") and invocations to that lambda should fail (currently, it can end up in a inconsistent state in this case, like lambdas being executed without layers).

Lambda state should reflect the current internal state, and invocations should fail if not active.
mock_run_lambda.return_value = "[]"
            response = lambda_api.invoke_function(self.FUNCTION_NAME)
            self.assertEqual(b"[]\n", response[0].response[0])
            self.assertEqual(200, response[1])
            self._assert_contained({"Content-Type": "application/json"}, response[0].headers)
    @mock.patch("localstack.services.awslambda.lambda_api.run_lambda")
    def test_invoke_populated_list_json_response(self, mock_run_lambda):
        with self.app.test_request_context() as context:
            self._request_response(context)
            mock_run_lambda.return_value = '[true,1,"thing"]'
            response = lambda_api.invoke_function(self.FUNCTION_NAME)
            self.assertEqual(b'[true,1,"thing"]\n', response[0].response[0])
            self.assertEqual(200, response[1])
            self._assert_contained({"Content-Type": "application/json"}, response[0].headers)
    @mock.patch("localstack.services.awslambda.lambda_api.run_lambda")
    def test_invoke_string_json_response(self, mock_run_lambda):
        with self.app.test_request_context() as context:
            self._request_response(context)
            mock_run_lambda.return_value = '"thing"'
            response = lambda_api.invoke_function(self.FUNCTION_NAME)
            self.assertEqual(b'"thing"\n', response[0].response[0])
            self.assertEqual(200, response[1])
            self._assert_contained({"Content-Type": "application/json"}, response[0].headers)
    @mock.patch("localstack.services.awslambda.lambda_api.run_lambda")
    def test_invoke_integer_json_response(self, mock_run_lambda):
        with self.app.test_request_context() as context:
            self._request_response(context)
            mock_run_lambda.return_value = "1234"
            response = lambda_api.invoke_function(self.FUNCTION_NAME)
            self.assertEqual(b"1234\n", response[0].response[0])