diff --git a/check.go b/check.go index 4df41d04..55de87ac 100644 --- a/check.go +++ b/check.go @@ -44,7 +44,7 @@ Loop: continue } - versionTime := p.Tip.CommittedDate.Time + versionTime := p.Age() if len(request.Source.StatusFilters) > 0 { for _, statusFilter := range request.Source.StatusFilters { // "zero time - epoch = 0" @@ -70,7 +70,7 @@ Loop: } // Filter out commits that are too old. - if !versionTime.After(request.Version.CommittedDate) { + if !p.Age().After(request.Version.ChangedDate) { continue } @@ -232,7 +232,7 @@ func (r CheckResponse) Len() int { } func (r CheckResponse) Less(i, j int) bool { - return r[j].CommittedDate.After(r[i].CommittedDate) + return r[j].ChangedDate.After(r[i].ChangedDate) } func (r CheckResponse) Swap(i, j int) { diff --git a/check_test.go b/check_test.go index 86b7b540..6cc3cb2e 100644 --- a/check_test.go +++ b/check_test.go @@ -59,7 +59,7 @@ func TestCheck(t *testing.T) { pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.PushedDate.Time), }, }, @@ -69,11 +69,11 @@ func TestCheck(t *testing.T) { Repository: "itsdalmo/test-repository", AccessToken: "oauthtoken", }, - version: resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.PushedDate.Time), pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.PushedDate.Time), }, }, @@ -83,12 +83,12 @@ func TestCheck(t *testing.T) { Repository: "itsdalmo/test-repository", AccessToken: "oauthtoken", }, - version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.PushedDate.Time), pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.CommittedDate.Time), - resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.PushedDate.Time), + resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.PushedDate.Time), }, }, @@ -99,7 +99,7 @@ func TestCheck(t *testing.T) { AccessToken: "oauthtoken", Paths: []string{"terraform/*/*.tf", "terraform/*/*/*.tf"}, }, - version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.PushedDate.Time), pullRequests: testPullRequests, files: [][]string{ {"README.md", "travis.yml"}, @@ -107,7 +107,7 @@ func TestCheck(t *testing.T) { {"terraform/modules/variables.tf", "travis.yml"}, }, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.PushedDate.Time), }, }, @@ -118,7 +118,7 @@ func TestCheck(t *testing.T) { AccessToken: "oauthtoken", IgnorePaths: []string{"*.md", "*.yml"}, }, - version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.PushedDate.Time), pullRequests: testPullRequests, files: [][]string{ {"README.md", "travis.yml"}, @@ -126,7 +126,7 @@ func TestCheck(t *testing.T) { {"terraform/modules/variables.tf", "travis.yml"}, }, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.PushedDate.Time), }, }, @@ -137,10 +137,10 @@ func TestCheck(t *testing.T) { AccessToken: "oauthtoken", DisableCISkip: true, }, - version: resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.PushedDate.Time), pullRequests: testPullRequests, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[0], testPullRequests[0].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[0], testPullRequests[0].Tip.PushedDate.Time), }, }, @@ -151,10 +151,10 @@ func TestCheck(t *testing.T) { AccessToken: "oauthtoken", IgnoreDrafts: true, }, - version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.PushedDate.Time), pullRequests: testPullRequests, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.PushedDate.Time), }, }, @@ -165,11 +165,11 @@ func TestCheck(t *testing.T) { AccessToken: "oauthtoken", IgnoreDrafts: false, }, - version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.PushedDate.Time), pullRequests: testPullRequests, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.CommittedDate.Time), - resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.PushedDate.Time), + resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.PushedDate.Time), }, }, @@ -180,12 +180,12 @@ func TestCheck(t *testing.T) { AccessToken: "oauthtoken", DisableForks: true, }, - version: resource.NewVersion(testPullRequests[5], testPullRequests[5].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[5], testPullRequests[5].Tip.PushedDate.Time), pullRequests: testPullRequests, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.CommittedDate.Time), - resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.CommittedDate.Time), - resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[3], testPullRequests[3].Tip.PushedDate.Time), + resource.NewVersion(testPullRequests[2], testPullRequests[2].Tip.PushedDate.Time), + resource.NewVersion(testPullRequests[1], testPullRequests[1].Tip.PushedDate.Time), }, }, @@ -200,7 +200,7 @@ func TestCheck(t *testing.T) { pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[6], testPullRequests[6].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[6], testPullRequests[6].Tip.PushedDate.Time), }, }, @@ -211,10 +211,10 @@ func TestCheck(t *testing.T) { AccessToken: "oauthtoken", RequiredReviewApprovals: 1, }, - version: resource.NewVersion(testPullRequests[8], testPullRequests[8].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[8], testPullRequests[8].Tip.PushedDate.Time), pullRequests: testPullRequests, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[7], testPullRequests[7].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[7], testPullRequests[7].Tip.PushedDate.Time), }, }, @@ -229,7 +229,7 @@ func TestCheck(t *testing.T) { pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[6], testPullRequests[6].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[6], testPullRequests[6].Tip.PushedDate.Time), }, }, @@ -244,7 +244,7 @@ func TestCheck(t *testing.T) { pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[9], testPullRequests[9].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[9], testPullRequests[9].Tip.PushedDate.Time), }, }, @@ -267,12 +267,12 @@ func TestCheck(t *testing.T) { AccessToken: "oauthtoken", States: []githubv4.PullRequestState{githubv4.PullRequestStateClosed, githubv4.PullRequestStateMerged}, }, - version: resource.NewVersion(testPullRequests[11], testPullRequests[11].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[11], testPullRequests[11].Tip.PushedDate.Time), pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[10], testPullRequests[10].Tip.CommittedDate.Time), - resource.NewVersion(testPullRequests[9], testPullRequests[9].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[10], testPullRequests[10].Tip.PushedDate.Time), + resource.NewVersion(testPullRequests[9], testPullRequests[9].Tip.PushedDate.Time), }, }, { @@ -288,7 +288,7 @@ func TestCheck(t *testing.T) { pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[12], testPullRequests[12].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[12], testPullRequests[12].Tip.PushedDate.Time), }, }, { @@ -300,11 +300,11 @@ func TestCheck(t *testing.T) { {Context: "my-status-check-2", State: "success"}, }, }, - version: resource.NewVersion(testPullRequests[9], testPullRequests[9].Tip.CommittedDate.Time), + version: resource.NewVersion(testPullRequests[9], testPullRequests[9].Tip.PushedDate.Time), pullRequests: testPullRequests, files: [][]string{}, expected: resource.CheckResponse{ - resource.NewVersion(testPullRequests[14], testPullRequests[14].Tip.Status.Contexts[0].CreatedAt.Time), + resource.NewVersion(testPullRequests[9], testPullRequests[9].Tip.PushedDate.Time), }, }, { @@ -322,7 +322,7 @@ func TestCheck(t *testing.T) { files: [][]string{}, expected: resource.CheckResponse{ // todo: pull request index - resource.NewVersion(testPullRequests[13], testPullRequests[13].Tip.CommittedDate.Time), + resource.NewVersion(testPullRequests[13], testPullRequests[13].Tip.PushedDate.Time), }, }, } diff --git a/in_test.go b/in_test.go index fc17b213..b93fd63d 100644 --- a/in_test.go +++ b/in_test.go @@ -37,13 +37,13 @@ func TestGet(t *testing.T) { version: resource.Version{ PR: "pr1", Commit: "commit1", - CommittedDate: time.Time{}, + ChangedDate: time.Time{}, ApprovedReviewCount: "0", State: githubv4.PullRequestStateOpen, }, parameters: resource.GetParameters{}, pullRequest: createTestPR(1, "master", false, false, 0, nil, false, githubv4.PullRequestStateOpen, []resource.StatusContext{}), - versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, + versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"user@example.com"},{"name":"state","value":"OPEN"}]`, }, { @@ -56,13 +56,13 @@ func TestGet(t *testing.T) { version: resource.Version{ PR: "pr1", Commit: "commit1", - CommittedDate: time.Time{}, + ChangedDate: time.Time{}, ApprovedReviewCount: "0", State: githubv4.PullRequestStateOpen, }, parameters: resource.GetParameters{}, pullRequest: createTestPR(1, "master", false, false, 0, nil, false, githubv4.PullRequestStateOpen, []resource.StatusContext{}), - versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, + versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"user@example.com"},{"name":"state","value":"OPEN"}]`, }, { @@ -74,7 +74,7 @@ func TestGet(t *testing.T) { version: resource.Version{ PR: "pr1", Commit: "commit1", - CommittedDate: time.Time{}, + ChangedDate: time.Time{}, ApprovedReviewCount: "0", State: githubv4.PullRequestStateOpen, }, @@ -82,7 +82,7 @@ func TestGet(t *testing.T) { IntegrationTool: "rebase", }, pullRequest: createTestPR(1, "master", false, false, 0, nil, false, githubv4.PullRequestStateOpen, []resource.StatusContext{}), - versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, + versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"user@example.com"},{"name":"state","value":"OPEN"}]`, }, { @@ -94,7 +94,7 @@ func TestGet(t *testing.T) { version: resource.Version{ PR: "pr1", Commit: "commit1", - CommittedDate: time.Time{}, + ChangedDate: time.Time{}, ApprovedReviewCount: "0", State: githubv4.PullRequestStateOpen, }, @@ -102,7 +102,7 @@ func TestGet(t *testing.T) { IntegrationTool: "checkout", }, pullRequest: createTestPR(1, "master", false, false, 0, nil, false, githubv4.PullRequestStateOpen, []resource.StatusContext{}), - versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, + versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"user@example.com"},{"name":"state","value":"OPEN"}]`, }, { @@ -114,7 +114,7 @@ func TestGet(t *testing.T) { version: resource.Version{ PR: "pr1", Commit: "commit1", - CommittedDate: time.Time{}, + ChangedDate: time.Time{}, ApprovedReviewCount: "0", State: githubv4.PullRequestStateOpen, }, @@ -122,7 +122,7 @@ func TestGet(t *testing.T) { GitDepth: 2, }, pullRequest: createTestPR(1, "master", false, false, 0, nil, false, githubv4.PullRequestStateOpen, []resource.StatusContext{}), - versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, + versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"user@example.com"},{"name":"state","value":"OPEN"}]`, }, { @@ -134,7 +134,7 @@ func TestGet(t *testing.T) { version: resource.Version{ PR: "pr1", Commit: "commit1", - CommittedDate: time.Time{}, + ChangedDate: time.Time{}, ApprovedReviewCount: "0", State: githubv4.PullRequestStateOpen, }, @@ -150,7 +150,7 @@ func TestGet(t *testing.T) { Path: "Other.md", }, }, - versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, + versionString: `{"pr":"pr1","commit":"commit1","committed":"0001-01-01T00:00:00Z","changed":"0001-01-01T00:00:00Z","approved_review_count":"0","state":"OPEN"}`, metadataString: `[{"name":"pr","value":"1"},{"name":"title","value":"pr1 title"},{"name":"url","value":"pr1 url"},{"name":"head_name","value":"pr1"},{"name":"head_sha","value":"oid1"},{"name":"base_name","value":"master"},{"name":"base_sha","value":"sha"},{"name":"message","value":"commit message1"},{"name":"author","value":"login1"},{"name":"author_email","value":"user@example.com"},{"name":"state","value":"OPEN"}]`, filesString: "README.md\nOther.md\n", }, @@ -292,9 +292,9 @@ func TestGetSkipDownload(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.GetParameters{SkipDownload: true}, }, @@ -376,10 +376,10 @@ func createTestPR( MergedAt: githubv4.DateTime{Time: time.Now()}, }, Tip: resource.CommitObject{ - ID: fmt.Sprintf("commit%s", n), - OID: fmt.Sprintf("oid%s", n), - CommittedDate: githubv4.DateTime{Time: d}, - Message: m, + ID: fmt.Sprintf("commit%s", n), + OID: fmt.Sprintf("oid%s", n), + PushedDate: &githubv4.DateTime{Time: d}, + Message: m, Author: struct { User struct{ Login string } Email string diff --git a/models.go b/models.go index 87592edd..acced814 100644 --- a/models.go +++ b/models.go @@ -80,18 +80,20 @@ type Version struct { PR string `json:"pr"` Commit string `json:"commit"` CommittedDate time.Time `json:"committed,omitempty"` + ChangedDate time.Time `json:"changed,omitempty"` ApprovedReviewCount string `json:"approved_review_count"` State githubv4.PullRequestState `json:"state"` } // NewVersion constructs a new Version. -func NewVersion(p *PullRequest, committedDate time.Time) Version { +func NewVersion(p *PullRequest, changedDate time.Time) Version { return Version{ PR: strconv.Itoa(p.Number), Commit: p.Tip.OID, ApprovedReviewCount: strconv.Itoa(p.ApprovedReviewCount), State: p.State, - CommittedDate: committedDate, + CommittedDate: p.Tip.CommittedDate.Time, + ChangedDate: changedDate, } } @@ -103,6 +105,22 @@ type PullRequest struct { Labels []LabelObject } +// Age: returns a date of the last update to the PR. +// If the job runs every minute, only PRs with an Age() in the last minute will run. +func (p *PullRequest) Age() time.Time { + age := p.Tip.PushedDate + if age == nil { + age = &p.Tip.CommittedDate + } + // handles the case where you're creating a fresh PR: + // there might be a few minutes between the push date and when you open the PR, + // so in that case take the CreatedAt date. + if age.Time.Before(p.CreatedAt.Time) { + age = &p.CreatedAt + } + return age.Time +} + // PullRequestObject represents the GraphQL commit node. // https://developer.github.com/v4/object/pullrequest/ type PullRequestObject struct { @@ -118,6 +136,7 @@ type PullRequestObject struct { IsCrossRepository bool IsDraft bool State githubv4.PullRequestState + CreatedAt githubv4.DateTime ClosedAt githubv4.DateTime MergedAt githubv4.DateTime } @@ -141,6 +160,7 @@ type CommitObject struct { ID string OID string CommittedDate githubv4.DateTime + PushedDate *githubv4.DateTime Message string Author struct { User struct { diff --git a/out_test.go b/out_test.go index ccfacd43..83a578fa 100644 --- a/out_test.go +++ b/out_test.go @@ -29,9 +29,9 @@ func TestPut(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{}, pullRequest: createTestPR(1, "master", false, false, 0, nil, false, githubv4.PullRequestStateOpen, []resource.StatusContext{}), @@ -44,9 +44,9 @@ func TestPut(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Status: "success", @@ -61,9 +61,9 @@ func TestPut(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Status: "failure", @@ -79,9 +79,9 @@ func TestPut(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Status: "failure", @@ -98,9 +98,9 @@ func TestPut(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Status: "failure", @@ -116,9 +116,9 @@ func TestPut(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Status: "failure", @@ -134,9 +134,9 @@ func TestPut(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Comment: "comment", @@ -151,9 +151,9 @@ func TestPut(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ DeletePreviousComments: true, @@ -243,9 +243,9 @@ func TestVariableSubstitution(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Comment: fmt.Sprintf("$%s", variableName), @@ -261,9 +261,9 @@ func TestVariableSubstitution(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Status: "failure", @@ -280,9 +280,9 @@ func TestVariableSubstitution(t *testing.T) { AccessToken: "oauthtoken", }, version: resource.Version{ - PR: "pr1", - Commit: "commit1", - CommittedDate: time.Time{}, + PR: "pr1", + Commit: "commit1", + ChangedDate: time.Time{}, }, parameters: resource.PutParameters{ Comment: "$THIS_IS_NOT_SUBSTITUTED",