diff options
author | Amine <hilalyamine@gmail.com> | 2019-10-01 10:53:54 +0200 |
---|---|---|
committer | Amine <hilalyamine@gmail.com> | 2019-10-01 10:53:54 +0200 |
commit | 8498deaa194f7ad3d69787d89e26feb280986d5c (patch) | |
tree | cc075711fbf1c07cd5070e9269d3e52234f8132e /bridge/gitlab/iterator.go | |
parent | f8121e59ae5b91585d11d30607cdf793e17809a7 (diff) | |
download | git-bug-8498deaa194f7ad3d69787d89e26feb280986d5c.tar.gz |
bridge/gitlab: fix integration tests
Diffstat (limited to 'bridge/gitlab/iterator.go')
-rw-r--r-- | bridge/gitlab/iterator.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bridge/gitlab/iterator.go b/bridge/gitlab/iterator.go index 198af79b..d5425cee 100644 --- a/bridge/gitlab/iterator.go +++ b/bridge/gitlab/iterator.go @@ -2,6 +2,7 @@ package gitlab import ( "context" + "sort" "time" "github.com/xanzy/go-gitlab" @@ -25,6 +26,20 @@ type labelEventIterator struct { cache []*gitlab.LabelEvent } +func (l *labelEventIterator) Len() int { + return len(l.cache) +} + +func (l *labelEventIterator) Swap(i, j int) { + element := l.cache[i] + l.cache[i] = l.cache[j] + l.cache[j] = element +} + +func (l *labelEventIterator) Less(i, j int) bool { + return l.cache[i].ID < l.cache[j].ID +} + type iterator struct { // gitlab api v4 client gc *gitlab.Client @@ -240,6 +255,8 @@ func (i *iterator) getNextLabelEvents() bool { i.labelEvent.cache = labelEvents i.labelEvent.page++ i.labelEvent.index = 0 + + sort.Sort(i.labelEvent) return true } |