Skip to content

Commit

Permalink
Adjust Go 1.17 changes + Travis fix (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwierzbo committed Oct 6, 2022
1 parent 9e06b23 commit e8cff66
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 21 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ services:
- docker

language: go
go:
- 1.17.6

env:
- TEST_SUITE=run-unit-tests GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 ALWAYS=1
Expand All @@ -37,9 +39,15 @@ env:
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 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
- TEST_SUITE=run-v2-tests-single GOIMAGE=gcr.io/gcr-for-testing/golang:1.17.6 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.10.0-rc.1 ALWAYS=1

script:
before_script:
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ ! -z "$ALWAYS" ]; then
make tools
make linter
fi
script:
- |
if [ "$TRAVIS_PULL_REQUEST" != "false" ] || [ ! -z "$ALWAYS" ]; then
make $TEST_SUITE TEST_RESOURCES="$HOME/resources/" VERBOSE=1;
fi
28 changes: 15 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ endif

all: build

build: $(SOURCES)
build: __dir_setup $(SOURCES)
go build -v $(REPOPATH) $(REPOPATH)/http $(REPOPATH)/vst $(REPOPATH)/agency $(REPOPATH)/jwt

clean:
Expand Down Expand Up @@ -429,7 +429,11 @@ ifeq ("$(DEBUG)", "true")
@docker build -f Dockerfile.debug --build-arg "TESTS_DIRECTORY=./tests" --build-arg "TESTS_ROOT_PATH=v2" -t $(GOIMAGE) .
endif

__test_prepare:
__dir_setup:
@mkdir -p "${TMPDIR}"
@echo "${TMPDIR}"

__test_prepare: __dir_setup
ifdef TEST_ENDPOINTS_OVERRIDE
@-docker rm -f -v $(TESTCONTAINER) &> /dev/null
@sleep 3
Expand All @@ -438,8 +442,6 @@ ifdef JWTSECRET
echo "$JWTSECRET" > "${JWTSECRETFILE}"
endif
@-docker rm -f -v $(TESTCONTAINER) &> /dev/null
@mkdir -p "${TMPDIR}"
@echo "${TMPDIR}"
@TESTCONTAINER=$(TESTCONTAINER) ARANGODB=$(ARANGODB) ALPINE_IMAGE=$(ALPINE_IMAGE) ENABLE_BACKUP=$(ENABLE_BACKUP) ARANGO_LICENSE_KEY=$(ARANGO_LICENSE_KEY) STARTER=$(STARTER) STARTERMODE=$(TEST_MODE) TMPDIR="${TMPDIR}" DEBUG_PORT=$(DEBUG_PORT) $(CLUSTERENV) "${ROOTDIR}/test/cluster.sh" start
endif

Expand Down Expand Up @@ -491,37 +493,37 @@ run-benchmarks-single-vpack-no-auth:
## Lint

.PHONY: tools
tools:
tools: __dir_setup
@echo ">> Fetching golangci-lint linter"
@GOBIN=$(TMPDIR)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.2
@echo ">> Fetching goimports"
@go get -mod 'readonly' golang.org/x/tools/cmd/goimports
@GOBIN=$(TMPDIR)/bin go install golang.org/x/tools/cmd/goimports@v0.1.12
@echo ">> Fetching license check"
@go get -mod 'readonly' github.com/google/addlicense
@GOBIN=$(TMPDIR)/bin go install github.com/google/addlicense@v1.0.0

.PHONY: license
license:
@echo ">> Ensuring license of files"
@go run -mod 'readonly' github.com/google/addlicense -f "$(ROOTDIR)/HEADER" $(SOURCES)
@$(TMPDIR)/bin/addlicense -f "$(ROOTDIR)/HEADER" $(SOURCES)

.PHONY: license-verify
license-verify:
@echo ">> Verify license of files"
@go run -mod 'readonly' github.com/google/addlicense -f "$(ROOTDIR)/HEADER" -check $(SOURCES)
@$(TMPDIR)/bin/addlicense -f "$(ROOTDIR)/HEADER" -check $(SOURCES)

.PHONY: fmt
fmt:
@echo ">> Ensuring style of files"
@go run -mod 'readonly' golang.org/x/tools/cmd/goimports -w $(SOURCES)
@$(TMPDIR)/bin/goimports -w $(SOURCES)

.PHONY: fmt-verify
fmt-verify: license-verify
@echo ">> Verify files style"
@if [ X"$$(go run -mod 'readonly' golang.org/x/tools/cmd/goimports -l $(SOURCES) | wc -l)" != X"0" ]; then echo ">> Style errors"; go run -mod 'readonly' golang.org/x/tools/cmd/goimports -l $(SOURCES); exit 1; fi
@if [ X"$$($(TMPDIR)/bin/goimports -l $(SOURCES) | wc -l)" != X"0" ]; then echo ">> Style errors"; $(TMPDIR)/bin/goimports -l $(SOURCES); exit 1; fi

.PHONY: linter
linter: fmt
$(TMPDIR)/bin/golangci-lint run ./...
linter: fmt-verify
@$(TMPDIR)/bin/golangci-lint run ./...

# V2

Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74 h1:4cFkmztxtMslUX2SctSl+blCyXfpzhGOy9LhKAqSMA4=
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
19 changes: 19 additions & 0 deletions http/connection_wrapper.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany

package http

import (
Expand Down
4 changes: 2 additions & 2 deletions test/pregel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
"context"
"testing"

"github.com/arangodb/go-driver"

"github.com/stretchr/testify/require"

"github.com/arangodb/go-driver"
)

func TestCreatePregelJob(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions test/server_metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"context"
"testing"

"github.com/arangodb/go-driver"

"github.com/stretchr/testify/require"

"github.com/arangodb/go-driver"
)

// TestGetServerMetrics tests if Client.Metrics works at all
Expand Down
23 changes: 21 additions & 2 deletions test/view_alias_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany

package test

import (
"context"
"testing"

"github.com/arangodb/go-driver"

"github.com/stretchr/testify/require"

"github.com/arangodb/go-driver"
)

// ensureArangoSearchView is a helper to check if an arangosearch view exists and create it if needed.
Expand Down
19 changes: 19 additions & 0 deletions v2/connection/decoder_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
//
// DISCLAIMER
//
// Copyright 2020 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Copyright holder is ArangoDB GmbH, Cologne, Germany

package connection

import (
Expand Down

0 comments on commit e8cff66

Please sign in to comment.