Skip to content

Commit 0e774da

Browse files
Merge branch 'develop'
2 parents f81fc29 + 14fce21 commit 0e774da

File tree

5 files changed

+41
-4
lines changed

5 files changed

+41
-4
lines changed

aws_lambda_builders/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
# Changing version will trigger a new release!
66
# Please make the version change as the last step of your development.
77

8-
__version__ = "1.46.0"
8+
__version__ = "1.47.0"
99
RPC_PROTOCOL_VERSION = "0.3"

aws_lambda_builders/workflows/go_modules/workflow.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ def __init__(
3232
handler = options.get("artifact_executable_name", None)
3333
trim_go_path = options.get("trim_go_path", False)
3434

35-
output_path = osutils.joinpath(artifacts_dir, handler)
35+
# For provided runtimes, the binary must be named "bootstrap"
36+
output_path = (
37+
osutils.joinpath(artifacts_dir, handler)
38+
if runtime != "provided"
39+
else osutils.joinpath(artifacts_dir, "bootstrap")
40+
)
3641

3742
builder = GoModulesBuilder(
3843
osutils,

requirements/dev.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
coverage==7.4.1
1+
coverage==7.4.3
22
flake8==3.8.4
33
pytest-cov==4.1.0
44

@@ -9,4 +9,4 @@ pyelftools~=0.30 # Used to verify the generated Go binary architecture in integr
99

1010
# formatter
1111
black==24.2.0
12-
ruff==0.2.1
12+
ruff==0.2.2

tests/integration/workflows/go_modules/test_go.py

+17
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from pathlib2 import Path
99

1010
from unittest import TestCase
11+
from parameterized import parameterized
12+
1113

1214
from aws_lambda_builders.builder import LambdaBuilder
1315
from aws_lambda_builders.exceptions import WorkflowFailedError
@@ -196,3 +198,18 @@ def test_builds_project_with_nested_dir(self):
196198
expected_files = {"helloWorld"}
197199
output_files = set(os.listdir(self.artifacts_dir))
198200
self.assertEqual(expected_files, output_files)
201+
202+
@parameterized.expand([("provided", "bootstrap"), ("go1.x", "helloWorld")])
203+
def test_binary_named_bootstrap_for_provided_runtime(self, runtime, expected_binary):
204+
source_dir = os.path.join(self.TEST_DATA_FOLDER, "no-deps")
205+
self.builder.build(
206+
source_dir,
207+
self.artifacts_dir,
208+
self.scratch_dir,
209+
os.path.join(source_dir, "go.mod"),
210+
runtime=runtime,
211+
options={"artifact_executable_name": "helloWorld"},
212+
)
213+
expected_files = {expected_binary}
214+
output_files = set(os.listdir(self.artifacts_dir))
215+
self.assertEqual(expected_files, output_files)

tests/unit/workflows/go_modules/test_workflow.py

+15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from unittest import TestCase
2+
from pathlib import Path
23

34
from aws_lambda_builders.workflows.go_modules.workflow import GoModulesWorkflow
45
from aws_lambda_builders.workflows.go_modules.actions import GoModulesBuildAction
@@ -24,6 +25,20 @@ def test_workflow_sets_up_builder_actions(self):
2425
self.assertEqual(len(workflow.actions), 1)
2526
self.assertIsInstance(workflow.actions[0], GoModulesBuildAction)
2627

28+
def test_workflow_sets_up_builder_actions_provided(self):
29+
workflow = GoModulesWorkflow(
30+
"source",
31+
"artifacts",
32+
"scratch_dir",
33+
"manifest",
34+
runtime="provided",
35+
options={"artifact_executable_name": "main"},
36+
)
37+
38+
self.assertEqual(len(workflow.actions), 1)
39+
self.assertIsInstance(workflow.actions[0], GoModulesBuildAction)
40+
self.assertEqual(workflow.actions[0].output_path, str(Path("artifacts", "bootstrap")))
41+
2742
def test_must_validate_architecture(self):
2843
workflow = GoModulesWorkflow(
2944
"source",

0 commit comments

Comments
 (0)