def test_must_provide_entrypoint_for_certain_runtimes_only(self, runtime):
        if runtime in RUNTIMES_WITH_ENTRYPOINT_OVERRIDES:
            result, _ = LambdaContainer._get_debug_settings(runtime, self.debug_options)
            self.assertIsNotNone(result, "{} runtime must provide entrypoint".format(runtime))

        elif runtime in RUNTIMES_WITH_DEBUG_ENV_VARS_ONLY:
            result, _ = LambdaContainer._get_debug_settings(runtime, self.debug_options)
            self.assertEqual("/var/rapid/init", result, "{} runtime must not override entrypoint".format(runtime))
        else:
            with self.assertRaises(DebuggingNotSupported):
                LambdaContainer._get_debug_settings(runtime, self.debug_options)
Exemplo n.º 2
0
    def test_delve_api_version_can_be_read_from_debug_args(
            self, version, debug_args):
        debug_options = DebugContext(debug_ports=[1235], debug_args=debug_args)
        _, env_vars = LambdaContainer._get_debug_settings(
            Runtime.go1x.value, debug_options)

        self.assertEqual(env_vars.get("_AWS_LAMBDA_GO_DELVE_API_VERSION"),
                         version)
Exemplo n.º 3
0
    def test_debug_arg_must_be_split_by_spaces_and_appended_to_bootstrap_based_entrypoint(self, runtime):
        """
        Debug args list is appended as arguments to bootstrap-args, which is past the fourth position in the array
        """
        expected_debug_args = ["a=b", "c=d", "e=f"]
        result, _ = LambdaContainer._get_debug_settings(runtime, self.debug_options)
        actual = result[4:5][0]

        self.assertTrue(all(debug_arg in actual for debug_arg in expected_debug_args))
Exemplo n.º 4
0
    def test_debug_arg_must_be_split_by_spaces_and_appended_to_entrypoint(self, runtime):
        """
        Debug args list is appended starting at second position in the array
        """
        expected_debug_args = ["a=b", "c=d", "e=f"]
        result, _ = LambdaContainer._get_debug_settings(runtime, self.debug_options)
        actual = result[1:4]

        self.assertEqual(actual, expected_debug_args)
Exemplo n.º 5
0
    def test_must_provide_entrypoint_even_without_debug_args(self, runtime):
        debug_options = DebugContext(debug_ports=[1235], debug_args=None)
        result, _ = LambdaContainer._get_debug_settings(runtime, debug_options)

        self.assertIsNotNone(result)
Exemplo n.º 6
0
    def test_must_provide_debug_env_vars(self, runtime):
        _, debug_env_vars = LambdaContainer._get_debug_settings(
            runtime, self.debug_options)

        self.assertIsNotNone(debug_env_vars)
Exemplo n.º 7
0
 def test_must_skip_if_debug_port_is_not_specified(self):
     self.assertEqual(
         ("/var/rapid/init", {}),
         LambdaContainer._get_debug_settings("runtime", None),
         "Must not provide entrypoint if debug port is not given",
     )
Exemplo n.º 8
0
 def test_must_skip_if_debug_port_is_not_specified(self):
     self.assertEqual(
         (LambdaContainer._DEFAULT_ENTRYPOINT, {}),
         LambdaContainer._get_debug_settings("runtime", None),
         "Must not provide entrypoint if debug port is not given",
     )