feat: Add etcd database support

improve concurrent access and high availability of aptly with the help of the characteristics of etcd
This commit is contained in:
hudeng
2022-02-08 11:16:16 +08:00
committed by André Roth
parent f42ff697d4
commit 78172d11d7
14 changed files with 497 additions and 6 deletions
+12 -1
View File
@@ -12,6 +12,10 @@ COVERAGE_DIR?=$(shell mktemp -d)
# Uncomment to update test outputs
# CAPTURE := "--capture"
# etcd test env
ETCD_VER=v3.5.2
DOWNLOAD_URL=https://storage.googleapis.com/etcd
all: modules test bench check system-test
# Self-documenting Makefile
@@ -22,6 +26,13 @@ help: ## Print this help
prepare:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell go env GOPATH)/bin $(GOLANGCI_LINT_VERSION)
etcd-prepare:
# etcd test prepare
rm -rf /tmp/etcd-download-test/test-data && mkdir -p /tmp/etcd-download-test/test-data
if [ ! -e /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz ]; then curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz; fi
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
/tmp/etcd-download-test/etcd --data-dir /tmp/etcd-download-test/test-data &
modules:
go mod download
go mod verify
@@ -68,7 +79,7 @@ docker-test: install
export APTLY_VERSION=$(VERSION); \
$(PYTHON) system/run.py --long $(TESTS) --coverage-dir $(COVERAGE_DIR) $(CAPTURE) $(TEST)
test:
test: etcd-prepare
go test -v ./... -gocheck.v=true -coverprofile=unit.out
bench: