aboutsummaryrefslogtreecommitdiffstats
path: root/services/migrations/main_test.go
diff options
context:
space:
mode:
authorAravinth Manivannan <realaravinth@batsense.net>2022-01-29 17:33:20 +0000
committerGitHub <noreply@github.com>2022-01-29 18:33:20 +0100
commite19b9653ea138c2ba9a5325e6fcbc696a0e758a3 (patch)
tree289489e1e972f9418229220b70112ce6eb5bd4bb /services/migrations/main_test.go
parent2ad74a503d2e31be2caa233bc7178fb8543788d2 (diff)
downloadgitea-e19b9653ea138c2ba9a5325e6fcbc696a0e758a3.tar.gz
gitea-e19b9653ea138c2ba9a5325e6fcbc696a0e758a3.zip
GitLab reviews may not have the updated_at field set (#18450)
* GitLab reviews may not have the updated_at field set Fallback to created_at if that the case and to time.Now() if it is also missing. Fixes: 18434 * use assert.WithinDuration Co-authored-by: Loïc Dachary <loic@dachary.org>
Diffstat (limited to 'services/migrations/main_test.go')
-rw-r--r--services/migrations/main_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/services/migrations/main_test.go b/services/migrations/main_test.go
index ddf73df98e..b040df83d1 100644
--- a/services/migrations/main_test.go
+++ b/services/migrations/main_test.go
@@ -223,15 +223,15 @@ func assertRepositoryEqual(t *testing.T, expected, actual *base.Repository) {
}
func assertReviewEqual(t *testing.T, expected, actual *base.Review) {
- assert.Equal(t, expected.ID, actual.ID)
- assert.Equal(t, expected.IssueIndex, actual.IssueIndex)
- assert.Equal(t, expected.ReviewerID, actual.ReviewerID)
- assert.Equal(t, expected.ReviewerName, actual.ReviewerName)
- assert.Equal(t, expected.Official, actual.Official)
- assert.Equal(t, expected.CommitID, actual.CommitID)
- assert.Equal(t, expected.Content, actual.Content)
- assertTimeEqual(t, expected.CreatedAt, actual.CreatedAt)
- assert.Equal(t, expected.State, actual.State)
+ assert.Equal(t, expected.ID, actual.ID, "ID")
+ assert.Equal(t, expected.IssueIndex, actual.IssueIndex, "IsssueIndex")
+ assert.Equal(t, expected.ReviewerID, actual.ReviewerID, "ReviewerID")
+ assert.Equal(t, expected.ReviewerName, actual.ReviewerName, "ReviewerName")
+ assert.Equal(t, expected.Official, actual.Official, "Official")
+ assert.Equal(t, expected.CommitID, actual.CommitID, "CommitID")
+ assert.Equal(t, expected.Content, actual.Content, "Content")
+ assert.WithinDuration(t, expected.CreatedAt, actual.CreatedAt, 10*time.Second)
+ assert.Equal(t, expected.State, actual.State, "State")
assertReviewCommentsEqual(t, expected.Comments, actual.Comments)
}