Skip to content

Commit 9724218

Browse files
authored
Small improvements (#379)
* Small improvements * Custom TEST_NET * Print DB logs in case of failure * Update arangodb images * Skip test which not applies for 3.7.1
1 parent 3304c7c commit 9724218

File tree

5 files changed

+48
-19
lines changed

5 files changed

+48
-19
lines changed

.travis.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,19 @@ language: go
2929

3030
env:
3131
- TEST_SUITE=run-unit-tests GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch ALWAYS=1
32-
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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
33-
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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
34-
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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.8
35-
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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
32+
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.6.16
33+
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.7.17
34+
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.8.5.1
35+
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.9.0 ALWAYS=1
3636
- TEST_SUITE=run-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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 TEST_DISALLOW_UNKNOWN_FIELDS=false
37-
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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
38-
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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
39-
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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.8
40-
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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
37+
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.6.16
38+
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.7.17
39+
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.8.5.1
40+
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-stretch STARTER=gcr.io/gcr-for-testing/arangodb/arangodb-starter:latest ALPINE_IMAGE=gcr.io/gcr-for-testing/alpine:3.4 ARANGODB=eu.gcr.io/arangodb-ci/official/arangodb/arangodb:3.9.0 ALWAYS=1
4141
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.16.6-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:
44-
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ ! -z "$ALWAYS" ]; then make $TEST_SUITE TEST_RESOURCES="$HOME/resources/" VERBOSE=1; fi'
44+
- |
45+
if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ ! -z "$ALWAYS" ]; then
46+
make $TEST_SUITE TEST_RESOURCES="$HOME/resources/" VERBOSE=1;
47+
fi

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ else ifeq ("$(TEST_AUTH)", "jwt")
6969
ARANGOARGS := --server.jwt-secret=/jwtsecret
7070
endif
7171

72-
TEST_NET := container:$(TESTCONTAINER)-ns
72+
TEST_NET := --net=container:$(TESTCONTAINER)-ns
7373
TEST_ENDPOINTS := http://localhost:7001
7474
TESTS := $(REPOPATH)/test
7575
ifeq ("$(TEST_AUTH)", "rootpw")
@@ -105,10 +105,14 @@ ifeq ("$(TEST_BENCHMARK)", "true")
105105
endif
106106

107107
ifdef TEST_ENDPOINTS_OVERRIDE
108-
TEST_NET := host
108+
TEST_NET := --net=host
109109
TEST_ENDPOINTS := $(TEST_ENDPOINTS_OVERRIDE)
110110
endif
111111

112+
ifdef TEST_NET_OVERRIDE
113+
TEST_NET := $(TEST_NET_OVERRIDE)
114+
endif
115+
112116
ifdef ENABLE_VST11
113117
VST11_SINGLE_TESTS := run-tests-single-vst-1.1
114118
VST11_RESILIENTSINGLE_TESTS := run-tests-resilientsingle-vst-1.1
@@ -367,7 +371,7 @@ __run_tests: __test_debug__ __test_prepare __test_go_test __test_cleanup
367371
__test_go_test:
368372
$(DOCKER_CMD) \
369373
--name=$(TESTCONTAINER) \
370-
--net=$(TEST_NET) \
374+
$(TEST_NET) \
371375
-v "${ROOTDIR}":/usr/code ${TEST_RESOURCES_VOLUME} \
372376
-e TEST_ENDPOINTS=$(TEST_ENDPOINTS) \
373377
-e TEST_NOT_WAIT_UNTIL_READY=$(TEST_NOT_WAIT_UNTIL_READY) \
@@ -387,15 +391,17 @@ __test_go_test:
387391
-e GODEBUG=tls13=1 \
388392
-e CGO_ENABLED=$(CGO_ENABLED) \
389393
-w /usr/code/ \
390-
$(DOCKER_RUN_CMD)
394+
$(DOCKER_RUN_CMD) && echo "success!" || \
395+
{ echo "failure! \n\nARANGODB-STARTER logs:"; docker logs ${TESTCONTAINER}-s; \
396+
echo "\nARANGODB logs:"; docker ps -f name=${TESTCONTAINER}-s- -q | xargs -L 1 docker logs; exit 1; }
391397

392398
# Internal test tasks
393399
__run_v2_tests: __test_v2_debug__ __test_prepare __test_v2_go_test __test_cleanup
394400

395401
__test_v2_go_test:
396402
$(DOCKER_CMD) \
397403
--name=$(TESTCONTAINER) \
398-
--net=$(TEST_NET) \
404+
$(TEST_NET) \
399405
-v "${ROOTDIR}":/usr/code:ro ${TEST_RESOURCES_VOLUME} \
400406
-e TEST_ENDPOINTS=$(TEST_ENDPOINTS) \
401407
-e TEST_NOT_WAIT_UNTIL_READY=$(TEST_NOT_WAIT_UNTIL_READY) \
@@ -409,7 +415,9 @@ __test_v2_go_test:
409415
-e GODEBUG=tls13=1 \
410416
-e CGO_ENABLED=$(CGO_ENABLED) \
411417
-w /usr/code/v2/ \
412-
$(DOCKER_V2_RUN_CMD)
418+
$(DOCKER_V2_RUN_CMD) && echo "success!" || \
419+
{ echo "failure! \n\nARANGODB-STARTER logs:"; docker logs ${TESTCONTAINER}-s; \
420+
echo "\nARANGODB logs:"; docker ps -f name=${TESTCONTAINER}-s- -q | xargs -L 1 docker logs; exit 1; }
413421

414422
__test_debug__:
415423
ifeq ("$(DEBUG)", "true")
@@ -456,7 +464,7 @@ run-tests-cluster-failover:
456464
go get github.com/coreos/go-iptables/iptables
457465
$(DOCKER_CMD) \
458466
--rm \
459-
--net=container:$(TESTCONTAINER)-ns \
467+
$(TEST_NET) \
460468
--privileged \
461469
-v "${ROOTDIR}":/usr/code \
462470
-e TEST_ENDPOINTS=http://127.0.0.1:7001,http://127.0.0.1:7006,http://127.0.0.1:7011 \

database_graphs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ type CreateGraphOptions struct {
8383
type EdgeDefinition struct {
8484
// The name of the edge collection to be used.
8585
Collection string `json:"collection"`
86-
// To contains the names of one or more edge collections that can contain target vertices.
86+
// To contains the names of one or more vertex collections that can contain target vertices.
8787
To []string `json:"to"`
8888
// From contains the names of one or more vertex collections that can contain source vertices.
8989
From []string `json:"from"`

edge_collection_documents_impl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ func (c *edgeCollection) removeDocument(ctx context.Context, key string) (Docume
486486
}
487487
cs := applyContextSettings(ctx, req)
488488
if cs.ReturnOld != nil {
489-
return DocumentMeta{}, contextSettings{}, WithStack(InvalidArgumentError{Message: "ReturnOld is not support when removing edges"})
489+
return DocumentMeta{}, contextSettings{}, WithStack(InvalidArgumentError{Message: "ReturnOld is not supported when removing edges"})
490490
}
491491
resp, err := c.conn.Do(ctx, req)
492492
if err != nil {

test/view_test.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030

3131
driver "github.com/arangodb/go-driver"
3232

33+
"github.com/stretchr/testify/assert"
3334
"github.com/stretchr/testify/require"
3435
)
3536

@@ -509,13 +510,15 @@ func TestUseArangoSearchView(t *testing.T) {
509510
func TestArangoSearchViewProperties35(t *testing.T) {
510511
ctx := context.Background()
511512
c := createClientFromEnv(t, true)
512-
skipBelowVersion(c, "3.5", t)
513+
skipBelowVersion(c, "3.7.1", t)
513514
db := ensureDatabase(ctx, c, "view_test", nil, t)
514515
ensureCollection(ctx, db, "someCol", nil, t)
515516
commitInterval := int64(100)
516517
sortDir := driver.ArangoSearchSortDirectionDesc
517518
name := "test_get_asview_35"
518519
sortField := "foo"
520+
storedValuesFields := []string{"now", "is", "the", "time"}
521+
storedValuesCompression := driver.PrimarySortCompressionNone
519522
opts := &driver.ArangoSearchViewProperties{
520523
Links: driver.ArangoSearchLinks{
521524
"someCol": driver.ArangoSearchElementProperties{},
@@ -525,6 +528,10 @@ func TestArangoSearchViewProperties35(t *testing.T) {
525528
Field: sortField,
526529
Direction: &sortDir,
527530
}},
531+
StoredValues: []driver.StoredValue{{
532+
Fields: storedValuesFields,
533+
Compression: storedValuesCompression,
534+
}},
528535
}
529536
if _, err := db.CreateArangoSearchView(ctx, name, opts); err != nil {
530537
t.Fatalf("Failed to create view '%s': %s", name, describe(err))
@@ -554,6 +561,17 @@ func TestArangoSearchViewProperties35(t *testing.T) {
554561
t.Errorf("Primary Sort field is wrong: %s, expected %s", ps.Field, sortField)
555562
}
556563
}
564+
565+
if len(p.StoredValues) != 1 {
566+
t.Fatalf("StoredValues expected length: %d, found %d", 1, len(p.StoredValues))
567+
} else {
568+
sv := p.StoredValues[0]
569+
if !assert.Equal(t, sv.Fields, storedValuesFields) {
570+
t.Errorf("StoredValues field is wrong: %s, expected %s", sv.Fields, storedValuesFields)
571+
} else if sv.Compression != storedValuesCompression {
572+
t.Errorf("StoredValues Compression is wrong: %s, expected %s", sv.Compression, storedValuesCompression)
573+
}
574+
}
557575
}
558576

559577
// TestArangoSearchPrimarySort

0 commit comments

Comments
 (0)