Skip to content

Commit 29f254b

Browse files
authored
refactor(go): Updated handler to artifact_executable_name for go workflows (#79)
1 parent cd4522e commit 29f254b

File tree

6 files changed

+15
-11
lines changed

6 files changed

+15
-11
lines changed

aws_lambda_builders/workflows/go_dep/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def __init__(self,
4545
**kwargs)
4646

4747
options = kwargs["options"] if "options" in kwargs else {}
48-
handler = options.get("handler", None)
48+
handler = options.get("artifact_executable_name", None)
4949

5050
if osutils is None:
5151
osutils = OSUtils()

aws_lambda_builders/workflows/go_modules/workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self,
3838
osutils = OSUtils()
3939

4040
options = kwargs.get("options") or {}
41-
handler = options.get("handler", None)
41+
handler = options.get("artifact_executable_name", None)
4242

4343
output_path = osutils.joinpath(artifacts_dir, handler)
4444

tests/integration/workflows/go_dep/test_go_dep.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_builds_project_with_no_deps(self):
3535
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir,
3636
os.path.join(source_dir, "Gopkg.toml"),
3737
runtime=self.runtime,
38-
options={"handler": "main"})
38+
options={"artifact_executable_name": "main"})
3939

4040
expected_files = {"main"}
4141
output_files = set(os.listdir(self.artifacts_dir))
@@ -49,7 +49,7 @@ def test_builds_project_with_no_gopkg_file(self):
4949
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir,
5050
os.path.join(source_dir, "Gopkg.toml"),
5151
runtime=self.runtime,
52-
options={"handler": "main"})
52+
options={"artifact_executable_name": "main"})
5353

5454
self.assertEquals(
5555
"GoDepBuilder:DepEnsure - Exec Failed: could not find project Gopkg.toml," +
@@ -62,7 +62,7 @@ def test_builds_project_with_remote_deps(self):
6262
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir,
6363
os.path.join(source_dir, "Gopkg.toml"),
6464
runtime=self.runtime,
65-
options={"handler": "main"})
65+
options={"artifact_executable_name": "main"})
6666

6767
expected_files = {"main"}
6868
output_files = set(os.listdir(self.artifacts_dir))
@@ -76,7 +76,7 @@ def test_builds_project_with_failed_remote_deps(self):
7676
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir,
7777
os.path.join(source_dir, "Gopkg.toml"),
7878
runtime=self.runtime,
79-
options={"handler": "main"})
79+
options={"artifact_executable_name": "main"})
8080

8181
# The full message is super long, so part of it is fine.
8282
self.assertNotEqual(str(ex.exception).find('unable to deduce repository and source type for'), -1)

tests/integration/workflows/go_modules/test_go.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_builds_project_without_dependencies(self):
3232
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir,
3333
os.path.join(source_dir, "go.mod"),
3434
runtime=self.runtime,
35-
options={"handler": "no-deps-main"})
35+
options={"artifact_executable_name": "no-deps-main"})
3636
expected_files = {"no-deps-main"}
3737
output_files = set(os.listdir(self.artifacts_dir))
3838
print(output_files)
@@ -43,7 +43,7 @@ def test_builds_project_with_dependencies(self):
4343
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir,
4444
os.path.join(source_dir, "go.mod"),
4545
runtime=self.runtime,
46-
options={"handler": "with-deps-main"})
46+
options={"artifact_executable_name": "with-deps-main"})
4747
expected_files = {"with-deps-main"}
4848
output_files = set(os.listdir(self.artifacts_dir))
4949
self.assertEquals(expected_files, output_files)
@@ -54,6 +54,6 @@ def test_fails_if_modules_cannot_resolve_dependencies(self):
5454
self.builder.build(source_dir, self.artifacts_dir, self.scratch_dir,
5555
os.path.join(source_dir, "go.mod"),
5656
runtime=self.runtime,
57-
options={"handler": "failed"})
57+
options={"artifact_executable_name": "failed"})
5858
self.assertIn("GoModulesBuilder:Build - Builder Failed: ",
5959
str(ctx.exception))

tests/unit/workflows/go_dep/test_workflow.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ class TestGoDepWorkflow(TestCase):
1111
"""
1212

1313
def test_workflow_sets_up_workflow(self):
14-
workflow = GoDepWorkflow("source", "artifacts", "scratch", "manifest", options={"handler": "foo"})
14+
workflow = GoDepWorkflow("source",
15+
"artifacts",
16+
"scratch",
17+
"manifest",
18+
options={"artifact_executable_name": "foo"})
1519
self.assertEqual(len(workflow.actions), 2)
1620
self.assertIsInstance(workflow.actions[0], DepEnsureAction)
1721
self.assertIsInstance(workflow.actions[1], GoBuildAction)

tests/unit/workflows/go_modules/test_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ def test_workflow_sets_up_builder_actions(self):
1414
workflow = GoModulesWorkflow(
1515
"source", "artifacts", "scratch_dir", "manifest",
1616
runtime="go1.x",
17-
options={"handler": "main"})
17+
options={"artifact_executable_name": "main"})
1818
self.assertEqual(len(workflow.actions), 1)
1919
self.assertIsInstance(workflow.actions[0], GoModulesBuildAction)

0 commit comments

Comments
 (0)