mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-22 16:48:30 +01:00
Merge pull request #11339 from ywk253100/200328_limit_offset
Add "order by" clause to avoid the duplicat rows
This commit is contained in:
commit
4faff18b2d
@ -97,6 +97,7 @@ func (d *dao) List(ctx context.Context, query *q.Query) ([]*Artifact, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qs = qs.OrderBy("-PushTime", "ID")
|
||||
if _, err = qs.All(&artifacts); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ func (d *dao) List(ctx context.Context, query *q.Query) ([]*models.RepoRecord, e
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qs = qs.OrderBy("-CreationTime", "RepositoryID")
|
||||
if _, err = qs.All(&repositories); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -71,6 +71,7 @@ func (d *dao) List(ctx context.Context, query *q.Query) ([]*tag.Tag, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
qs = qs.OrderBy("-PushTime", "ID")
|
||||
if _, err = qs.All(&tags); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -80,8 +80,8 @@ class TestProjects(unittest.TestCase):
|
||||
artifact = self.artifact.get_reference_info(TestProjects.project_name, self.repo_name, tag, **TestProjects.USER_CLIENT)
|
||||
|
||||
#6. Verify the image(IA) contains tag named 1.0;
|
||||
self.assertEqual(artifact[0].tags[0].name, tag)
|
||||
self.assertEqual(artifact[0].tags[1].name, "1.0")
|
||||
self.assertEqual(artifact[0].tags[0].name, "1.0")
|
||||
self.assertEqual(artifact[0].tags[1].name, tag)
|
||||
|
||||
#7. Delete the tag(1.0) from image(IA);
|
||||
self.artifact.delete_tag(TestProjects.project_name, self.repo_name, tag, "1.0",**TestProjects.USER_CLIENT)
|
||||
|
Loading…
Reference in New Issue
Block a user