aboutsummaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorAmine <hilalyamine@gmail.com>2019-10-01 10:53:54 +0200
committerAmine <hilalyamine@gmail.com>2019-10-01 10:53:54 +0200
commit8498deaa194f7ad3d69787d89e26feb280986d5c (patch)
treecc075711fbf1c07cd5070e9269d3e52234f8132e /bridge
parentf8121e59ae5b91585d11d30607cdf793e17809a7 (diff)
downloadgit-bug-8498deaa194f7ad3d69787d89e26feb280986d5c.tar.gz
bridge/gitlab: fix integration tests
Diffstat (limited to 'bridge')
-rw-r--r--bridge/gitlab/import_test.go2
-rw-r--r--bridge/gitlab/iterator.go17
2 files changed, 18 insertions, 1 deletions
diff --git a/bridge/gitlab/import_test.go b/bridge/gitlab/import_test.go
index 20fc67c7..a6fd8524 100644
--- a/bridge/gitlab/import_test.go
+++ b/bridge/gitlab/import_test.go
@@ -19,7 +19,7 @@ import (
)
func TestImport(t *testing.T) {
- author := identity.NewIdentity("Amine hilaly", "hilalyamine@gmail.com")
+ author := identity.NewIdentity("Amine Hilaly", "hilalyamine@gmail.com")
tests := []struct {
name string
url string
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
}