Skip to content

Commit 9cc66b6

Browse files
authored
[Bugfix] Fix issue BTS-427 (#308)
Modify tests for removed endpoint in ArangoDB 3.7.x
1 parent e244968 commit 9cc66b6

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ env:
3232
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb:3.6
3333
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb:latest ALWAYS=1
3434
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb:3.7
35-
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:3.8.0-beta.1
35+
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:3.8.0-nightly
3636
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:latest
3737
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb:3.6
3838
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb:latest ALWAYS=1
3939
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb:3.7
40-
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:3.8.0-beta.1
40+
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:3.8.0-nightly
4141
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.13.4-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=gcr.io/gcr-for-testing/arangodb/arangodb-preview:latest
4242

4343
script:

revision.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,20 @@ type RevisionRanges struct {
4545

4646
// RevisionTreeNode is a leaf in Merkle tree with hashed Revisions and with count of documents in the leaf
4747
type RevisionTreeNode struct {
48-
Hash string `json:"hash"`
49-
Count int64 `json:"count,int"`
48+
Hash uint64 `json:"hash"`
49+
Count uint64 `json:"count,int"`
5050
}
5151

5252
// RevisionTree is a list of Revisions in a Merkle tree
5353
type RevisionTree struct {
54-
Version int `json:"version"`
55-
MaxDepth int `json:"maxDepth"`
56-
RangeMin RevisionUInt64 `json:"rangeMin,string" velocypack:"rangeMin"`
57-
RangeMax RevisionUInt64 `json:"rangeMax,string" velocypack:"rangeMax"`
58-
Nodes []RevisionTreeNode `json:"nodes"`
54+
Version int `json:"version"`
55+
MaxDepth int `json:"maxDepth"`
56+
RangeMin RevisionUInt64 `json:"rangeMin,string" velocypack:"rangeMin"`
57+
RangeMax RevisionUInt64 `json:"rangeMax,string" velocypack:"rangeMax"`
58+
InitialRangeMin RevisionUInt64 `json:"initialRangeMin,string" velocypack:"initialRangeMin"`
59+
Count uint64 `json:"count,int"`
60+
Hash uint64 `json:"hash"`
61+
Nodes []RevisionTreeNode `json:"nodes"`
5962
}
6063

6164
var (

test/revisions_test.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestRevisionTree(t *testing.T) {
3939
t.Skipf("Not a single")
4040
}
4141
c := createClientFromEnv(t, true)
42-
skipBelowVersion(c, "3.7", t)
42+
skipBelowVersion(c, "3.8", t)
4343

4444
db := ensureDatabase(nil, c, "revision_tree", nil, t)
4545
col := ensureCollection(nil, db, "revision_tree", nil, t)
@@ -79,15 +79,19 @@ func TestRevisionTree(t *testing.T) {
7979
require.NotEmpty(t, tree.Version)
8080
require.NotEmpty(t, tree.RangeMin)
8181
require.NotEmpty(t, tree.RangeMax)
82+
require.NotEmpty(t, tree.InitialRangeMin)
8283
require.NotEmpty(t, tree.Nodes)
8384

8485
branchFactor := 8
8586
noOfLeavesOnLevel := 1
8687
noOfLeaves := noOfLeavesOnLevel
8788
for i := 1; i <= tree.MaxDepth; i++ {
8889
noOfLeavesOnLevel *= branchFactor
89-
noOfLeaves += noOfLeavesOnLevel
90+
if i == tree.MaxDepth {
91+
noOfLeaves = noOfLeavesOnLevel
92+
}
9093
}
94+
require.Equalf(t, noOfDocuments, int(tree.Count), "Count value of tree is not correct")
9195
require.Equalf(t, noOfLeaves, len(tree.Nodes), "Number of leaves in the revision tree is not correct")
9296

9397
getRanges := func() driver.Revisions {

0 commit comments

Comments
 (0)