Skip to content

Commit d9f7423

Browse files
committed
Fix test
1 parent 960420f commit d9f7423

File tree

6 files changed

+41
-24
lines changed

6 files changed

+41
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Mark ArangoSync component as deprecated
55
- Do not allow starting ArangoDB v3.12+ with ArangoSync component
66
- Do not allow upgrade if the cluster is using ArangoSync component (if the new version is v3.12 or newer)
7+
- Bump Go version (v1.21.6) and dependencies for CVE fixes
78

89
## [v0.18.2](https://github.com/arangodb-helper/arangodb/tree/0.18.2) (2024-02-13)
910
- Fix waiting for local slaves to terminate

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
ARG IMAGE=alpine:3.16
2-
FROM ${IMAGE}
1+
ARG IMAGE
2+
FROM alpine:${IMAGE}
33
MAINTAINER Max Neunhoeffer <[email protected]>
44

55
ARG TARGETARCH

Makefile

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ ifeq (, $(findstring -preview,$(VERSION)))
2121
-t $(IMAGE_NAME):latest
2222
endif
2323

24-
ALPINE_IMAGE ?= alpine:3.16
24+
ALPINE_IMAGE ?= 3.18
2525

2626
DOCKERCLI ?= $(shell which docker)
2727
GOBUILDLINKTARGET := ../../../..
@@ -43,8 +43,8 @@ REPODIR := $(ORGDIR)/$(REPONAME)
4343
REPOPATH := $(ORGPATH)/$(REPONAME)
4444

4545
GOPATH := $(GOBUILDDIR)
46-
GOVERSION := 1.21.5
47-
GOIMAGE ?= golang:$(GOVERSION)-alpine3.17
46+
GOVERSION := 1.21.6
47+
GOIMAGE ?= golang:$(GOVERSION)-alpine$(ALPINE_IMAGE)
4848

4949
GOOS ?= linux
5050
GOARCH ?= amd64
@@ -100,7 +100,7 @@ TEST_BIN := /usr/code/bin/$(GOOS)/$(GOARCH)/$(TESTNAME)
100100
RELEASE_BIN := /usr/code/.gobuild/bin/release
101101

102102
DOCKER_CMD = $(DOCKERCLI) run \
103-
--rm --platform linux/$(GOARCH) \
103+
--rm \
104104
-v $(SRCDIR):/usr/code \
105105
-u "$(shell id -u):$(shell id -g)" \
106106
-e GOCACHE=/usr/code/.gobuild/.cache \
@@ -144,12 +144,23 @@ build: vendor $(BIN)
144144
build-test: vendor $(TESTBIN)
145145
@echo ">> Build Tests Bin $(TESTBIN) done"
146146

147-
binaries:
147+
binary-linux:
148148
@${MAKE} -f $(MAKEFILE) -B GOOS=linux GOARCH=amd64 build
149149
@${MAKE} -f $(MAKEFILE) -B GOOS=linux GOARCH=arm64 build
150+
@${MAKE} -f $(MAKEFILE) -B GOOS=linux GOARCH=amd64 build-test
151+
@${MAKE} -f $(MAKEFILE) -B GOOS=linux GOARCH=arm64 build-test
152+
153+
binary-darwin:
150154
@${MAKE} -f $(MAKEFILE) -B GOOS=darwin GOARCH=amd64 build
151155
@${MAKE} -f $(MAKEFILE) -B GOOS=darwin GOARCH=arm64 build
156+
@${MAKE} -f $(MAKEFILE) -B GOOS=darwin GOARCH=amd64 build-test
157+
@${MAKE} -f $(MAKEFILE) -B GOOS=darwin GOARCH=arm64 build-test
158+
159+
binary-windows:
152160
@${MAKE} -f $(MAKEFILE) -B GOOS=windows GOARCH=amd64 build
161+
@${MAKE} -f $(MAKEFILE) -B GOOS=windows GOARCH=amd64 build-test
162+
163+
binaries: binary-linux binary-darwin binary-windows
153164

154165
releases:
155166
@${MAKE} -f $(MAKEFILE) -B GOOS=linux GOARCH=amd64 release
@@ -159,13 +170,6 @@ releases:
159170
@${MAKE} -f $(MAKEFILE) -B GOOS=windows GOARCH=amd64 release
160171
@(cd "$(RELEASEDIR)"; sha256sum arangodb-* > SHA256SUMS; cat SHA256SUMS | sha256sum -c)
161172

162-
binaries-test:
163-
@${MAKE} -f $(MAKEFILE) -B GOOS=linux GOARCH=amd64 build-test
164-
@${MAKE} -f $(MAKEFILE) -B GOOS=linux GOARCH=arm64 build-test
165-
@${MAKE} -f $(MAKEFILE) -B GOOS=darwin GOARCH=amd64 build-test
166-
@${MAKE} -f $(MAKEFILE) -B GOOS=darwin GOARCH=arm64 build-test
167-
@${MAKE} -f $(MAKEFILE) -B GOOS=windows GOARCH=amd64 build-test
168-
169173
$(BIN): $(GOBUILDDIR) $(GO_SOURCES)
170174
@mkdir -p $(BINDIR)
171175
@-rm -f resource.syso
@@ -223,7 +227,7 @@ run-unit-tests: $(GO_SOURCES)
223227
# Run all integration tests
224228
run-tests: run-tests-local-process run-tests-docker
225229

226-
run-tests-local-process: build-test build run-tests-local-process-run
230+
run-tests-local-process: binary-linux run-tests-local-process-run
227231
run-tests-local-process-run: export TEST_MODES=localprocess
228232
run-tests-local-process-run: export DOCKER_IMAGE=$(ARANGODB)
229233
run-tests-local-process-run: export DOCKER_PARAMS:=-e "TEST_MODES=$(TEST_MODES)" -e "STARTER_MODES=$(STARTER_MODES)" -e "STARTER=/usr/code/bin/linux/$(GOARCH)/arangodb"

test/docker_cluster_sync_test.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2018 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2018-2024 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -17,8 +17,6 @@
1717
//
1818
// Copyright holder is ArangoDB GmbH, Cologne, Germany
1919
//
20-
// Author Ewout Prangsma
21-
//
2220

2321
package test
2422

@@ -33,6 +31,8 @@ import (
3331
// TestDockerClusterSync runs 3 arangodb starters in docker with arangosync enabled.
3432
func TestDockerClusterSync(t *testing.T) {
3533
testMatch(t, testModeDocker, starterModeCluster, true)
34+
requireArangoSync(t, testModeDocker)
35+
3636
ip := os.Getenv("IP")
3737
require.NotEmpty(t, ip, "IP envvar must be set to IP address of this machine")
3838

@@ -70,6 +70,8 @@ func TestDockerClusterSync(t *testing.T) {
7070

7171
func TestDockerClusterRestartWithSyncOnAndOff(t *testing.T) {
7272
testMatch(t, testModeDocker, starterModeCluster, true)
73+
requireArangoSync(t, testModeDocker)
74+
7375
ip := os.Getenv("IP")
7476
require.NotEmpty(t, ip, "IP envvar must be set to IP address of this machine")
7577

@@ -121,6 +123,8 @@ func TestDockerClusterRestartWithSyncOnAndOff(t *testing.T) {
121123

122124
func TestDockerLocalClusterRestartWithSyncOnAndOff(t *testing.T) {
123125
testMatch(t, testModeDocker, starterModeCluster, true)
126+
requireArangoSync(t, testModeDocker)
127+
124128
ip := os.Getenv("IP")
125129
require.NotEmpty(t, ip, "IP envvar must be set to IP address of this machine")
126130

test/process_cluster_sync_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// DISCLAIMER
33
//
4-
// Copyright 2018-2023 ArangoDB GmbH, Cologne, Germany
4+
// Copyright 2018-2024 ArangoDB GmbH, Cologne, Germany
55
//
66
// Licensed under the Apache License, Version 2.0 (the "License");
77
// you may not use this file except in compliance with the License.
@@ -37,6 +37,7 @@ import (
3737
func TestProcessClusterSync(t *testing.T) {
3838
removeArangodProcesses(t)
3939
testMatch(t, testModeProcess, starterModeCluster, true)
40+
requireArangoSync(t, testModeProcess)
4041

4142
// Create certificates
4243
ip := "127.0.0.1"
@@ -70,6 +71,7 @@ func TestProcessClusterSync(t *testing.T) {
7071
func TestProcessClusterRestartWithSyncOnAndOff(t *testing.T) {
7172
removeArangodProcesses(t)
7273
testMatch(t, testModeProcess, starterModeCluster, true)
74+
requireArangoSync(t, testModeProcess)
7375

7476
// Create certificates
7577
ip := "127.0.0.1"
@@ -123,6 +125,7 @@ func TestProcessClusterRestartWithSyncOnAndOff(t *testing.T) {
123125
func TestProcessLocalClusterRestartWithSyncOnAndOff(t *testing.T) {
124126
removeArangodProcesses(t)
125127
testMatch(t, testModeProcess, starterModeCluster, true)
128+
requireArangoSync(t, testModeProcess)
126129

127130
// Create certificates
128131
ip := "127.0.0.1"
@@ -177,6 +180,7 @@ func TestProcessLocalClusterRestartWithSyncOnAndOff(t *testing.T) {
177180
func TestProcessClusterRestartWithSyncDisabledThenUpgrade(t *testing.T) {
178181
removeArangodProcesses(t)
179182
testMatch(t, testModeProcess, starterModeCluster, true)
183+
requireArangoSync(t, testModeProcess)
180184

181185
// Create certificates
182186
ip := "127.0.0.1"

test/util.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,19 @@ func needModeSupportedByVersion(t *testing.T, testMode, starterMode string) {
137137
}
138138
}
139139

140+
func requireArangoSync(t *testing.T, testMode string) {
141+
if !getSupportedDatabaseFeatures(t, testMode).SupportsArangoSync() {
142+
t.Skip("ArangoSync is not supported")
143+
}
144+
}
145+
140146
func isModeSupportedByVersion(t *testing.T, testMode, starterMode string) bool {
141147
f := getSupportedDatabaseFeatures(t, testMode)
142148

143149
if starterMode == starterModeActiveFailover {
144-
return f.SupportsActiveFailover()
145-
}
146-
147-
if starterMode == starterModeActiveFailover {
148-
return f.SupportsArangoSync()
150+
if !f.SupportsActiveFailover() {
151+
return false
152+
}
149153
}
150154

151155
return true

0 commit comments

Comments
 (0)