@@ -16,10 +16,10 @@ func TestFetchRepoTags(t *testing.T) {
1616 resetTables (t , sqlDB )
1717
1818 allTags := []* db.RepoTag {
19- // Ordered by Created DESC, which is how we expect it returned.
20- {OrgRepoName : "foo/gaz" , TagName : "v0.0.1" , ModulePath : "github.somecompany.net/foo/gaz" , Created : time .Now ().Add (time .Minute )},
21- {OrgRepoName : "foo/bar" , TagName : "v0.0.2" , ModulePath : "github.somecompany.net/foo/bar" , Created : time .Now ().Add (time .Second )},
19+ // Ordered by Created ASC (ascending chronological order), which is how we expect it returned.
2220 {OrgRepoName : "foo/bar" , TagName : "v0.0.1" , ModulePath : "github.somecompany.net/foo/bar" , Created : time .Now ()},
21+ {OrgRepoName : "foo/bar" , TagName : "v0.0.2" , ModulePath : "github.somecompany.net/foo/bar" , Created : time .Now ().Add (time .Second )},
22+ {OrgRepoName : "foo/gaz" , TagName : "v0.0.1" , ModulePath : "github.somecompany.net/foo/gaz" , Created : time .Now ().Add (time .Minute )},
2323 }
2424 populateRepoTags (t , sqlDB , allTags )
2525
@@ -46,7 +46,7 @@ func TestFetchRepoTags(t *testing.T) {
4646 if err != nil {
4747 t .Fatal (err )
4848 }
49- if diff := cmp .Diff (allTags [: 1 ], gotTags , cmpopts .EquateApproxTime (time .Second )); diff != "" {
49+ if diff := cmp .Diff (allTags [2 : ], gotTags , cmpopts .EquateApproxTime (time .Second )); diff != "" {
5050 t .Errorf ("FetchRepoTags: -want,+got: %s" , diff )
5151 }
5252}
0 commit comments