-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up CodePipeline Job Implementation (#382)
* [BREAKING CHANGE] Clean up CodePipeline Job Implementation * Incorrectly used "CodePipelineEvent" * Fix original typo missed when moving to job * Maintain backwards compatibility while making the ambiguity more clear * go fmt * Fix up a merge issue and stray input
- Loading branch information
1 parent
99b35f2
commit ee817dd
Showing
5 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package events | ||
|
||
// CodePipelineJob has been incorrectly assigned as CodePipelineEvent | ||
// - https://github.com/aws/aws-lambda-go/issues/244 | ||
// This maintains backwards compatability until a v2 release | ||
type CodePipelineEvent = CodePipelineJobEvent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
package events | ||
|
||
import ( | ||
"encoding/json" | ||
"io/ioutil" | ||
"testing" | ||
|
||
"github.com/aws/aws-lambda-go/events/test" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCodePipeLineJobEventMarshaling(t *testing.T) { | ||
|
||
// read json from file | ||
inputJSON, err := ioutil.ReadFile("./testdata/codepipeline-job-event.json") | ||
if err != nil { | ||
t.Errorf("could not open test file. details: %v", err) | ||
} | ||
|
||
// de-serialize into CodePipelineJobEvent | ||
var inputEvent CodePipelineJobEvent | ||
if err := json.Unmarshal(inputJSON, &inputEvent); err != nil { | ||
t.Errorf("could not unmarshal event. details: %v", err) | ||
} | ||
|
||
// serialize to json | ||
outputJSON, err := json.Marshal(inputEvent) | ||
if err != nil { | ||
t.Errorf("could not marshal event. details: %v", err) | ||
} | ||
|
||
assert.JSONEq(t, string(inputJSON), string(outputJSON)) | ||
} | ||
|
||
func TestCodePipelineJobEventMarshalingMalformedJson(t *testing.T) { | ||
test.TestMalformedJson(t, CodePipelineJobEvent{}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.