Skip to content

Commit

Permalink
Add phase-type of QUEUED as constant (#234)
Browse files Browse the repository at this point in the history
* Add phase-type of QUEUED as constant

* Add to the test data also

* fix assertions
  • Loading branch information
whithajess authored and bmoffatt committed Oct 11, 2019
1 parent 81cc163 commit 62a881e
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions events/codebuild.go
Expand Up @@ -27,6 +27,7 @@ type CodeBuildPhaseType string

const (
CodeBuildPhaseTypeSubmitted CodeBuildPhaseType = "SUBMITTED"
CodeBuildPhaseTypeQueued = "QUEUED"
CodeBuildPhaseTypeProvisioning = "PROVISIONING"
CodeBuildPhaseTypeDownloadSource = "DOWNLOAD_SOURCE"
CodeBuildPhaseTypeInstall = "INSTALL"
Expand Down
19 changes: 18 additions & 1 deletion events/codebuild_test.go
Expand Up @@ -2,10 +2,11 @@ package events

import (
"encoding/json"
"github.com/stretchr/testify/require"
"io/ioutil"
"testing"
"time"

"github.com/stretchr/testify/require"
)

func TestUnmarshalCodeBuildEvent(t *testing.T) {
Expand Down Expand Up @@ -71,6 +72,14 @@ func TestUnmarshalCodeBuildEvent(t *testing.T) {
PhaseType: CodeBuildPhaseTypeSubmitted,
PhaseStatus: CodeBuildPhaseStatusSucceeded,
},
{
PhaseContext: []interface{}{},
StartTime: CodeBuildTime(time.Date(2017, 9, 1, 16, 12, 29, 0, time.UTC)),
EndTime: CodeBuildTime(time.Date(2019, 9, 13, 4, 12, 29, 0, time.UTC)),
Duration: DurationSeconds(0),
PhaseType: CodeBuildPhaseTypeQueued,
PhaseStatus: CodeBuildPhaseStatusSucceeded,
},
{
PhaseContext: []interface{}{},
StartTime: CodeBuildTime(time.Date(2017, 9, 1, 16, 12, 29, 0, time.UTC)),
Expand Down Expand Up @@ -200,6 +209,14 @@ func TestUnmarshalCodeBuildEvent(t *testing.T) {
PhaseType: CodeBuildPhaseTypeSubmitted,
PhaseStatus: CodeBuildPhaseStatusSucceeded,
},
{
PhaseContext: []interface{}{},
StartTime: CodeBuildTime(time.Date(2017, 9, 1, 16, 12, 29, 0, time.UTC)),
EndTime: CodeBuildTime(time.Date(2019, 9, 13, 4, 12, 29, 0, time.UTC)),
Duration: DurationSeconds(0),
PhaseType: CodeBuildPhaseTypeQueued,
PhaseStatus: CodeBuildPhaseStatusSucceeded,
},
{
PhaseContext: []interface{}{},
StartTime: CodeBuildTime(time.Date(2017, 9, 1, 16, 12, 29, 0, time.UTC)),
Expand Down
8 changes: 8 additions & 0 deletions events/testdata/codebuild-phase-change.json
Expand Up @@ -49,6 +49,14 @@
"phase-type": "SUBMITTED",
"phase-status": "SUCCEEDED"
},
{
"phase-context": [],
"start-time": "Sep 1, 2017 4:12:29 PM",
"end-time": "Sep 13, 2019 4:12:29 AM",
"duration-in-seconds": 0.0,
"phase-type": "QUEUED",
"phase-status": "SUCCEEDED"
},
{
"phase-context": [],
"start-time": "Sep 1, 2017 4:12:29 PM",
Expand Down
8 changes: 8 additions & 0 deletions events/testdata/codebuild-state-change.json
Expand Up @@ -54,6 +54,14 @@
"phase-type": "SUBMITTED",
"phase-status": "SUCCEEDED"
},
{
"phase-context": [],
"start-time": "Sep 1, 2017 4:12:29 PM",
"end-time": "Sep 13, 2019 4:12:29 AM",
"duration-in-seconds": 0.0,
"phase-type": "QUEUED",
"phase-status": "SUCCEEDED"
},
{
"phase-context": [],
"start-time": "Sep 1, 2017 4:12:29 PM",
Expand Down

0 comments on commit 62a881e

Please sign in to comment.