Merge pull request #20 from thockin/use-build-template
Use build template
This commit is contained in:
commit
7fdc7486bc
|
|
@ -1 +1,5 @@
|
||||||
/bin
|
/bin
|
||||||
|
/.go
|
||||||
|
/.push-*
|
||||||
|
/.container-*
|
||||||
|
/.dockerfile-*
|
||||||
|
|
|
||||||
21
Dockerfile
21
Dockerfile
|
|
@ -1,21 +0,0 @@
|
||||||
FROM gcr.io/google_containers/ubuntu-slim:0.1
|
|
||||||
|
|
||||||
ARG ARCH
|
|
||||||
ADD bin/git-sync-${ARCH} /git-sync
|
|
||||||
|
|
||||||
ENV GIT_SYNC_DEST /git
|
|
||||||
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y git ca-certificates --no-install-recommends && \
|
|
||||||
apt-get install -y openssh-client && \
|
|
||||||
apt-get clean -y && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Move the existing SSH binary, then replace it with the wrapper script
|
|
||||||
RUN mv /usr/bin/ssh /usr/bin/ssh-binary
|
|
||||||
COPY ssh-wrapper.sh /usr/bin/ssh
|
|
||||||
RUN chmod 755 /usr/bin/ssh
|
|
||||||
|
|
||||||
RUN mkdir /nonexistent && chmod 777 /nonexistent
|
|
||||||
|
|
||||||
ENTRYPOINT ["/git-sync"]
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Copyright 2016 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
FROM ARG_FROM
|
||||||
|
|
||||||
|
MAINTAINER Tim Hockin <thockin@google.com>
|
||||||
|
|
||||||
|
ADD bin/ARG_ARCH/ARG_BIN /ARG_BIN
|
||||||
|
ENV GIT_SYNC_DEST /git
|
||||||
|
|
||||||
|
# Move the existing SSH binary, then replace it with the wrapper script
|
||||||
|
RUN apk update --no-cache && apk add \
|
||||||
|
ca-certificates \
|
||||||
|
coreutils \
|
||||||
|
git \
|
||||||
|
openssh-client
|
||||||
|
RUN mv /usr/bin/ssh /usr/bin/ssh-binary
|
||||||
|
ADD ssh-wrapper.sh /usr/bin/ssh
|
||||||
|
RUN chmod 755 /usr/bin/ssh
|
||||||
|
|
||||||
|
USER nobody:nobody
|
||||||
|
ENTRYPOINT ["/ARG_BIN"]
|
||||||
176
Makefile
176
Makefile
|
|
@ -12,82 +12,150 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
.PHONY: all push push-legacy container clean
|
# The binary to build (just the basename).
|
||||||
|
BIN := git-sync
|
||||||
|
|
||||||
REGISTRY ?= gcr.io/google_containers
|
# This repo's root import path (under GOPATH).
|
||||||
IMAGE = $(REGISTRY)/git-sync-$(ARCH)
|
PKG := k8s.io/git-sync
|
||||||
LEGACY_AMD64_IMAGE = $(REGISTRY)/git-sync
|
|
||||||
|
|
||||||
TAG = v2.0.2
|
# Where to push the docker image.
|
||||||
|
REGISTRY ?= gcr.io/google-containers
|
||||||
|
|
||||||
# Architectures supported: amd64, arm, arm64 and ppc64le
|
# Which architecture to build - see $(ALL_ARCH) for options.
|
||||||
ARCH ?= amd64
|
ARCH ?= amd64
|
||||||
|
|
||||||
# TODO: get a base image for non-x86 archs
|
# This version-strategy uses git tags to set the version string
|
||||||
|
VERSION := $(shell git describe --tags --always --dirty)
|
||||||
|
#
|
||||||
|
# This version-strategy uses a manual value to set the version string
|
||||||
|
#VERSION := 1.2.3
|
||||||
|
|
||||||
|
###
|
||||||
|
### These variables should not need tweaking.
|
||||||
|
###
|
||||||
|
|
||||||
|
SRC_DIRS := cmd pkg # directories which hold app source (not vendored)
|
||||||
|
|
||||||
|
ALL_ARCH := amd64
|
||||||
|
|
||||||
|
# TODO: get a baseimage that works for other architectures
|
||||||
# arm arm64 ppc64le
|
# arm arm64 ppc64le
|
||||||
ALL_ARCH = amd64
|
|
||||||
|
|
||||||
KUBE_CROSS_IMAGE ?= gcr.io/google_containers/kube-cross
|
# Set default base image dynamically for each arch
|
||||||
KUBE_CROSS_VERSION ?= v1.6.3-2
|
ifeq ($(ARCH),amd64)
|
||||||
|
BASEIMAGE?=alpine:3.4
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),arm)
|
||||||
|
BASEIMAGE?=armel/busybox
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),arm64)
|
||||||
|
BASEIMAGE?=aarch64/busybox
|
||||||
|
endif
|
||||||
|
ifeq ($(ARCH),ppc64le)
|
||||||
|
BASEIMAGE?=ppc64le/busybox
|
||||||
|
endif
|
||||||
|
|
||||||
GO_PKG = k8s.io/git-sync
|
IMAGE := $(REGISTRY)/$(BIN)-$(ARCH)
|
||||||
BIN = git-sync
|
LEGACY_IMAGE := $(REGISTRY)/$(BIN)
|
||||||
|
|
||||||
|
BUILD_IMAGE ?= golang:1.7-alpine
|
||||||
|
|
||||||
|
# If you want to build all binaries, see the 'all-build' rule.
|
||||||
# If you want to build all containers, see the 'all-container' rule.
|
# If you want to build all containers, see the 'all-container' rule.
|
||||||
# If you want to build AND push all containers, see the 'all-push' rule.
|
# If you want to build AND push all containers, see the 'all-push' rule.
|
||||||
all: all-build
|
all: build
|
||||||
|
|
||||||
sub-container-%:
|
build-%:
|
||||||
$(MAKE) ARCH=$* container
|
@$(MAKE) --no-print-directory ARCH=$* build
|
||||||
|
|
||||||
sub-push-%:
|
container-%:
|
||||||
$(MAKE) ARCH=$* push
|
@$(MAKE) --no-print-directory ARCH=$* container
|
||||||
|
|
||||||
all-build: $(addprefix bin/$(BIN)-,$(ALL_ARCH))
|
push-%:
|
||||||
|
@$(MAKE) --no-print-directory ARCH=$* push
|
||||||
|
|
||||||
all-container: $(addprefix sub-container-,$(ALL_ARCH))
|
all-build: $(addprefix build-, $(ALL_ARCH))
|
||||||
|
|
||||||
all-push: $(addprefix sub-push-,$(ALL_ARCH))
|
all-container: $(addprefix container-, $(ALL_ARCH))
|
||||||
|
|
||||||
build: bin/$(BIN)-$(ARCH)
|
all-push: $(addprefix push-, $(ALL_ARCH))
|
||||||
|
|
||||||
bin/$(BIN)-$(ARCH): FORCE
|
build: bin/$(ARCH)/$(BIN)
|
||||||
mkdir -p bin
|
|
||||||
docker run \
|
bin/$(ARCH)/$(BIN): build-dirs
|
||||||
|
@echo "building: $@"
|
||||||
|
@docker run \
|
||||||
|
-ti \
|
||||||
-u $$(id -u):$$(id -g) \
|
-u $$(id -u):$$(id -g) \
|
||||||
-v $$(pwd):/go/src/$(GO_PKG) \
|
-v $$(pwd)/.go:/go \
|
||||||
$(KUBE_CROSS_IMAGE):$(KUBE_CROSS_VERSION) \
|
-v $$(pwd):/go/src/$(PKG) \
|
||||||
/bin/bash -c " \
|
-v $$(pwd)/bin/$(ARCH):/go/bin \
|
||||||
cd /go/src/$(GO_PKG) && \
|
-v $$(pwd)/bin/$(ARCH):/go/bin/linux_$(ARCH) \
|
||||||
CGO_ENABLED=0 go build \
|
-v $$(pwd)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)_static \
|
||||||
-installsuffix cgo \
|
-w /go/src/$(PKG) \
|
||||||
-ldflags '-w' \
|
$(BUILD_IMAGE) \
|
||||||
-o $@"
|
/bin/sh -c " \
|
||||||
|
ARCH=$(ARCH) \
|
||||||
|
VERSION=$(VERSION) \
|
||||||
|
PKG=$(PKG) \
|
||||||
|
./build/build.sh \
|
||||||
|
"
|
||||||
|
|
||||||
container: .container-$(ARCH)
|
DOTFILE_IMAGE = $(subst /,_,$(IMAGE))-$(VERSION)
|
||||||
.container-$(ARCH): bin/$(BIN)-$(ARCH)
|
|
||||||
docker build -t $(IMAGE):$(TAG) --build-arg ARCH=$(ARCH) .
|
|
||||||
ifeq ($(ARCH),amd64)
|
|
||||||
docker tag $(IMAGE):$(TAG) $(LEGACY_AMD64_IMAGE):$(TAG)
|
|
||||||
endif
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
push: .push-$(ARCH)
|
container: .container-$(DOTFILE_IMAGE) container-name
|
||||||
.push-$(ARCH): .container-$(ARCH)
|
.container-$(DOTFILE_IMAGE): bin/$(ARCH)/$(BIN) Dockerfile.in
|
||||||
gcloud docker push $(IMAGE):$(TAG)
|
@sed \
|
||||||
touch $@
|
-e 's|ARG_BIN|$(BIN)|g' \
|
||||||
|
-e 's|ARG_ARCH|$(ARCH)|g' \
|
||||||
|
-e 's|ARG_FROM|$(BASEIMAGE)|g' \
|
||||||
|
Dockerfile.in > .dockerfile-$(ARCH)
|
||||||
|
@docker build -t $(IMAGE):$(VERSION) -f .dockerfile-$(ARCH) .
|
||||||
|
@docker images -q $(IMAGE):$(VERSION) > $@
|
||||||
|
@if [ "$(ARCH)" == "amd64" ]; then \
|
||||||
|
docker tag $(IMAGE):$(VERSION) $(LEGACY_IMAGE):$(VERSION); \
|
||||||
|
fi
|
||||||
|
|
||||||
push-legacy: .push-legacy-$(ARCH)
|
container-name:
|
||||||
.push-legacy-$(ARCH): .container-$(ARCH)
|
@echo "container: $(IMAGE):$(VERSION)"
|
||||||
ifeq ($(ARCH),amd64)
|
|
||||||
gcloud docker push $(LEGACY_AMD64_IMAGE):$(TAG)
|
|
||||||
endif
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
test:
|
push: .push-$(DOTFILE_IMAGE) push-name
|
||||||
@./test.sh
|
.push-$(DOTFILE_IMAGE): .container-$(DOTFILE_IMAGE)
|
||||||
|
@gcloud docker push $(IMAGE):$(VERSION)
|
||||||
|
@docker images -q $(IMAGE):$(VERSION) > $@
|
||||||
|
@if [ "$(ARCH)" == "amd64" ]; then \
|
||||||
|
gcloud docker push $(LEGACY_IMAGE):$(TAG); \
|
||||||
|
fi
|
||||||
|
|
||||||
clean:
|
push-name:
|
||||||
rm -rf .container-* .push-* bin/
|
@echo "pushed: $(IMAGE):$(VERSION)"
|
||||||
|
|
||||||
FORCE:
|
version:
|
||||||
|
@echo $(VERSION)
|
||||||
|
|
||||||
|
test: build-dirs
|
||||||
|
@docker run \
|
||||||
|
-ti \
|
||||||
|
-u $$(id -u):$$(id -g) \
|
||||||
|
-v $$(pwd)/.go:/go \
|
||||||
|
-v $$(pwd):/go/src/$(PKG) \
|
||||||
|
-v $$(pwd)/bin/$(ARCH):/go/bin \
|
||||||
|
-v $$(pwd)/.go/std/$(ARCH):/usr/local/go/pkg/linux_$(ARCH)_static \
|
||||||
|
-w /go/src/$(PKG) \
|
||||||
|
$(BUILD_IMAGE) \
|
||||||
|
/bin/sh -c " \
|
||||||
|
./build/test.sh $(SRC_DIRS) \
|
||||||
|
"
|
||||||
|
@./test_e2e.sh
|
||||||
|
|
||||||
|
build-dirs:
|
||||||
|
@mkdir -p bin/$(ARCH)
|
||||||
|
@mkdir -p .go/src/$(PKG) .go/pkg .go/bin .go/std/$(ARCH)
|
||||||
|
|
||||||
|
clean: container-clean bin-clean
|
||||||
|
|
||||||
|
container-clean:
|
||||||
|
rm -rf .container-* .dockerfile-* .push-*
|
||||||
|
|
||||||
|
bin-clean:
|
||||||
|
rm -rf .go bin
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright 2016 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
if [ -z "${PKG}" ]; then
|
||||||
|
echo "PKG must be set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "${ARCH}" ]; then
|
||||||
|
echo "ARCH must be set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -z "${VERSION}" ]; then
|
||||||
|
echo "VERSION must be set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
export GOARCH="${ARCH}"
|
||||||
|
|
||||||
|
go install \
|
||||||
|
-installsuffix "static" \
|
||||||
|
-ldflags "-X ${PKG}/pkg/version.VERSION=${VERSION}" \
|
||||||
|
./...
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright 2016 The Kubernetes Authors.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o nounset
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
export CGO_ENABLED=0
|
||||||
|
|
||||||
|
TARGETS=$(for d in "$@"; do echo ./$d/...; done)
|
||||||
|
|
||||||
|
echo "Running tests:"
|
||||||
|
go test -i -installsuffix "static" ${TARGETS}
|
||||||
|
go test -installsuffix "static" ${TARGETS}
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -n "Checking gofmt: "
|
||||||
|
ERRS=$(find "$@" -type f -name \*.go | xargs gofmt -l 2>&1 || true)
|
||||||
|
if [ -n "${ERRS}" ]; then
|
||||||
|
echo "FAIL - the following files need to be gofmt'ed:"
|
||||||
|
for e in ${ERRS}; do
|
||||||
|
echo " $e"
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "PASS"
|
||||||
|
echo
|
||||||
|
|
||||||
|
echo -n "Checking go vet: "
|
||||||
|
ERRS=$(go vet ${TARGETS} 2>&1 || true)
|
||||||
|
if [ -n "${ERRS}" ]; then
|
||||||
|
echo "FAIL"
|
||||||
|
echo "${ERRS}"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "PASS"
|
||||||
|
echo
|
||||||
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||||
|
|
||||||
// git-sync is a command that pull a git repository to a local directory.
|
// git-sync is a command that pull a git repository to a local directory.
|
||||||
|
|
||||||
package main // import "k8s.io/git-sync"
|
package main // import "k8s.io/git-sync/cmd/git-sync"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
@ -50,7 +50,7 @@ var flRoot = flag.String("root", envString("GIT_SYNC_ROOT", "/git"),
|
||||||
"the root directory for git operations")
|
"the root directory for git operations")
|
||||||
var flDest = flag.String("dest", envString("GIT_SYNC_DEST", ""),
|
var flDest = flag.String("dest", envString("GIT_SYNC_DEST", ""),
|
||||||
"the name at which to publish the checked-out files under --root (defaults to leaf dir of --root)")
|
"the name at which to publish the checked-out files under --root (defaults to leaf dir of --root)")
|
||||||
var flWait = flag.Int("wait", envInt("GIT_SYNC_WAIT", 0),
|
var flWait = flag.Float64("wait", envFloat("GIT_SYNC_WAIT", 0),
|
||||||
"the number of seconds between syncs")
|
"the number of seconds between syncs")
|
||||||
var flOneTime = flag.Bool("one-time", envBool("GIT_SYNC_ONE_TIME", false),
|
var flOneTime = flag.Bool("one-time", envBool("GIT_SYNC_ONE_TIME", false),
|
||||||
"exit after the initial checkout")
|
"exit after the initial checkout")
|
||||||
|
|
@ -101,7 +101,19 @@ func envInt(key string, def int) int {
|
||||||
if env := os.Getenv(key); env != "" {
|
if env := os.Getenv(key); env != "" {
|
||||||
val, err := strconv.Atoi(env)
|
val, err := strconv.Atoi(env)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("invalid value for %q: using default: %q", key, def)
|
log.Errorf("invalid value for %q: using default: %v", key, def)
|
||||||
|
return def
|
||||||
|
}
|
||||||
|
return val
|
||||||
|
}
|
||||||
|
return def
|
||||||
|
}
|
||||||
|
|
||||||
|
func envFloat(key string, def float64) float64 {
|
||||||
|
if env := os.Getenv(key); env != "" {
|
||||||
|
val, err := strconv.ParseFloat(env, 64)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("invalid value for %q: using default: %v", key, def)
|
||||||
return def
|
return def
|
||||||
}
|
}
|
||||||
return val
|
return val
|
||||||
|
|
@ -147,6 +159,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// From here on, output goes through logging.
|
// From here on, output goes through logging.
|
||||||
|
log.V(0).Infof("starting up: %q", os.Args)
|
||||||
|
|
||||||
initialSync := true
|
initialSync := true
|
||||||
failCount := 0
|
failCount := 0
|
||||||
|
|
@ -159,8 +172,8 @@ func main() {
|
||||||
|
|
||||||
failCount++
|
failCount++
|
||||||
log.Errorf("unexpected error syncing repo: %v", err)
|
log.Errorf("unexpected error syncing repo: %v", err)
|
||||||
log.V(0).Infof("waiting %d seconds before retryng", *flWait)
|
log.V(0).Infof("waiting %v before retrying", waitTime(*flWait))
|
||||||
time.Sleep(time.Duration(*flWait) * time.Second)
|
time.Sleep(waitTime(*flWait))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if initialSync {
|
if initialSync {
|
||||||
|
|
@ -178,11 +191,15 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
failCount = 0
|
failCount = 0
|
||||||
log.V(1).Infof("next sync in %d seconds", *flWait)
|
log.V(1).Infof("next sync in %v", waitTime(*flWait))
|
||||||
time.Sleep(time.Duration(*flWait) * time.Second)
|
time.Sleep(waitTime(*flWait))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func waitTime(seconds float64) time.Duration {
|
||||||
|
return time.Duration(int(seconds*1000)) * time.Millisecond
|
||||||
|
}
|
||||||
|
|
||||||
func setFlagDefaults() {
|
func setFlagDefaults() {
|
||||||
// Force logging to stderr.
|
// Force logging to stderr.
|
||||||
stderrFlag := flag.Lookup("logtostderr")
|
stderrFlag := flag.Lookup("logtostderr")
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*
|
||||||
|
Copyright 2016 The Kubernetes Authors.
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package version
|
||||||
|
|
||||||
|
var VERSION = "UNKNOWN"
|
||||||
|
|
@ -13,6 +13,9 @@ function testcase() {
|
||||||
|
|
||||||
function fail() {
|
function fail() {
|
||||||
echo "FAIL: " "$@"
|
echo "FAIL: " "$@"
|
||||||
|
sleep 1
|
||||||
|
pkill git-sync || true
|
||||||
|
ps auxw | grep git-sync
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,9 +51,7 @@ function assert_file_eq() {
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
# Build it
|
# Build it
|
||||||
echo "Building..."
|
make container REGISTRY=e2e TAG=$(make -s version)
|
||||||
make >/dev/null
|
|
||||||
GIT_SYNC=./bin/git-sync-amd64
|
|
||||||
|
|
||||||
DIR=""
|
DIR=""
|
||||||
for i in $(seq 1 10); do
|
for i in $(seq 1 10); do
|
||||||
|
|
@ -61,7 +62,17 @@ if [[ -z "$DIR" ]]; then
|
||||||
echo "Failed to make a temp dir"
|
echo "Failed to make a temp dir"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "Test root is $DIR"
|
echo "test root is $DIR"
|
||||||
|
|
||||||
|
function GIT_SYNC() {
|
||||||
|
#./bin/amd64/git-sync "$@"
|
||||||
|
docker run \
|
||||||
|
-i \
|
||||||
|
-u $(id -u):$(id -g) \
|
||||||
|
-v "$DIR":"$DIR" \
|
||||||
|
e2e/git-sync-amd64:$(make -s version) \
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
REPO="$DIR/repo"
|
REPO="$DIR/repo"
|
||||||
mkdir "$REPO"
|
mkdir "$REPO"
|
||||||
|
|
@ -84,9 +95,10 @@ testcase "head-once"
|
||||||
# First sync
|
# First sync
|
||||||
echo "$TESTCASE" > "$REPO"/file
|
echo "$TESTCASE" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE"
|
git -C "$REPO" commit -qam "$TESTCASE"
|
||||||
$GIT_SYNC \
|
GIT_SYNC \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
--wait=0.1 \
|
||||||
--repo="$REPO" \
|
--repo="$REPO" \
|
||||||
--branch=master \
|
--branch=master \
|
||||||
--rev=HEAD \
|
--rev=HEAD \
|
||||||
|
|
@ -96,6 +108,7 @@ $GIT_SYNC \
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE"
|
||||||
|
# Wrap up
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Test default syncing
|
# Test default syncing
|
||||||
|
|
@ -103,30 +116,33 @@ testcase "default-sync"
|
||||||
# First sync
|
# First sync
|
||||||
echo "$TESTCASE 1" > "$REPO"/file
|
echo "$TESTCASE 1" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 1"
|
git -C "$REPO" commit -qam "$TESTCASE 1"
|
||||||
$GIT_SYNC \
|
GIT_SYNC \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
--wait=0.1 \
|
||||||
--repo="$REPO" \
|
--repo="$REPO" \
|
||||||
--root="$ROOT" \
|
--root="$ROOT" \
|
||||||
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
# Move forward
|
# Move forward
|
||||||
echo "$TESTCASE 2" > "$REPO"/file
|
echo "$TESTCASE 2" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 2"
|
git -C "$REPO" commit -qam "$TESTCASE 2"
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
||||||
# Move backward
|
# Move backward
|
||||||
git -C "$REPO" reset -q --hard HEAD^
|
git -C "$REPO" reset -q --hard HEAD^
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
kill %1
|
# Wrap up
|
||||||
|
pkill git-sync
|
||||||
|
wait
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Test HEAD syncing
|
# Test HEAD syncing
|
||||||
|
|
@ -134,32 +150,35 @@ testcase "head-sync"
|
||||||
# First sync
|
# First sync
|
||||||
echo "$TESTCASE 1" > "$REPO"/file
|
echo "$TESTCASE 1" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 1"
|
git -C "$REPO" commit -qam "$TESTCASE 1"
|
||||||
$GIT_SYNC \
|
GIT_SYNC \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
--wait=0.1 \
|
||||||
--repo="$REPO" \
|
--repo="$REPO" \
|
||||||
--branch=master \
|
--branch=master \
|
||||||
--rev=HEAD \
|
--rev=HEAD \
|
||||||
--root="$ROOT" \
|
--root="$ROOT" \
|
||||||
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
# Move HEAD forward
|
# Move HEAD forward
|
||||||
echo "$TESTCASE 2" > "$REPO"/file
|
echo "$TESTCASE 2" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 2"
|
git -C "$REPO" commit -qam "$TESTCASE 2"
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
||||||
# Move HEAD backward
|
# Move HEAD backward
|
||||||
git -C "$REPO" reset -q --hard HEAD^
|
git -C "$REPO" reset -q --hard HEAD^
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
kill %1
|
# Wrap up
|
||||||
|
pkill git-sync
|
||||||
|
wait
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Test branch syncing
|
# Test branch syncing
|
||||||
|
|
@ -170,14 +189,15 @@ git -C "$REPO" checkout -q -b "$BRANCH"
|
||||||
echo "$TESTCASE 1" > "$REPO"/file
|
echo "$TESTCASE 1" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 1"
|
git -C "$REPO" commit -qam "$TESTCASE 1"
|
||||||
git -C "$REPO" checkout -q master
|
git -C "$REPO" checkout -q master
|
||||||
$GIT_SYNC \
|
GIT_SYNC \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
--wait=0.1 \
|
||||||
--repo="$REPO" \
|
--repo="$REPO" \
|
||||||
--branch="$BRANCH" \
|
--branch="$BRANCH" \
|
||||||
--root="$ROOT" \
|
--root="$ROOT" \
|
||||||
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
|
|
@ -186,7 +206,7 @@ git -C "$REPO" checkout -q "$BRANCH"
|
||||||
echo "$TESTCASE 2" > "$REPO"/file
|
echo "$TESTCASE 2" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 2"
|
git -C "$REPO" commit -qam "$TESTCASE 2"
|
||||||
git -C "$REPO" checkout -q master
|
git -C "$REPO" checkout -q master
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
||||||
|
|
@ -194,11 +214,13 @@ assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
||||||
git -C "$REPO" checkout -q "$BRANCH"
|
git -C "$REPO" checkout -q "$BRANCH"
|
||||||
git -C "$REPO" reset -q --hard HEAD^
|
git -C "$REPO" reset -q --hard HEAD^
|
||||||
git -C "$REPO" checkout -q master
|
git -C "$REPO" checkout -q master
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
kill %1
|
# Wrap up
|
||||||
|
pkill git-sync
|
||||||
|
wait
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Test tag syncing
|
# Test tag syncing
|
||||||
|
|
@ -208,14 +230,15 @@ TAG="$TESTCASE"--TAG
|
||||||
echo "$TESTCASE 1" > "$REPO"/file
|
echo "$TESTCASE 1" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 1"
|
git -C "$REPO" commit -qam "$TESTCASE 1"
|
||||||
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 1" >/dev/null
|
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 1" >/dev/null
|
||||||
$GIT_SYNC \
|
GIT_SYNC \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
--wait=0.1 \
|
||||||
--repo="$REPO" \
|
--repo="$REPO" \
|
||||||
--rev="$TAG" \
|
--rev="$TAG" \
|
||||||
--root="$ROOT" \
|
--root="$ROOT" \
|
||||||
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
|
|
@ -223,25 +246,27 @@ assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
echo "$TESTCASE 2" > "$REPO"/file
|
echo "$TESTCASE 2" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 2"
|
git -C "$REPO" commit -qam "$TESTCASE 2"
|
||||||
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 2" >/dev/null
|
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 2" >/dev/null
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
||||||
# Move the tag backward
|
# Move the tag backward
|
||||||
git -C "$REPO" reset -q --hard HEAD^
|
git -C "$REPO" reset -q --hard HEAD^
|
||||||
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 3" >/dev/null
|
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 3" >/dev/null
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
# Add something after the tag
|
# Add something after the tag
|
||||||
echo "$TESTCASE 3" > "$REPO"/file
|
echo "$TESTCASE 3" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 3"
|
git -C "$REPO" commit -qam "$TESTCASE 3"
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
kill %1
|
# Wrap up
|
||||||
|
pkill git-sync
|
||||||
|
wait
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Test cross-branch tag syncing
|
# Test cross-branch tag syncing
|
||||||
|
|
@ -254,14 +279,15 @@ echo "$TESTCASE 1" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 1"
|
git -C "$REPO" commit -qam "$TESTCASE 1"
|
||||||
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 1" >/dev/null
|
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 1" >/dev/null
|
||||||
git -C "$REPO" checkout -q master
|
git -C "$REPO" checkout -q master
|
||||||
$GIT_SYNC \
|
GIT_SYNC \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
--wait=0.1 \
|
||||||
--repo="$REPO" \
|
--repo="$REPO" \
|
||||||
--rev="$TAG" \
|
--rev="$TAG" \
|
||||||
--root="$ROOT" \
|
--root="$ROOT" \
|
||||||
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
|
|
@ -271,7 +297,7 @@ echo "$TESTCASE 2" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 2"
|
git -C "$REPO" commit -qam "$TESTCASE 2"
|
||||||
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 1" >/dev/null
|
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 1" >/dev/null
|
||||||
git -C "$REPO" checkout -q master
|
git -C "$REPO" checkout -q master
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 2"
|
||||||
|
|
@ -280,7 +306,7 @@ git -C "$REPO" checkout -q "$BRANCH"
|
||||||
git -C "$REPO" reset -q --hard HEAD^
|
git -C "$REPO" reset -q --hard HEAD^
|
||||||
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 1" >/dev/null
|
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 1" >/dev/null
|
||||||
git -C "$REPO" checkout -q master
|
git -C "$REPO" checkout -q master
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
|
|
@ -289,7 +315,7 @@ git -C "$REPO" checkout -q "$BRANCH"
|
||||||
echo "$TESTCASE 3" > "$REPO"/file
|
echo "$TESTCASE 3" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 3"
|
git -C "$REPO" commit -qam "$TESTCASE 3"
|
||||||
git -C "$REPO" checkout -q master
|
git -C "$REPO" checkout -q master
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
|
|
@ -297,11 +323,13 @@ assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
git -C "$REPO" checkout -q "$BRANCH"
|
git -C "$REPO" checkout -q "$BRANCH"
|
||||||
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 3" >/dev/null
|
git -C "$REPO" tag -af "$TAG" -m "$TESTCASE 3" >/dev/null
|
||||||
git -C "$REPO" checkout -q master
|
git -C "$REPO" checkout -q master
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 3"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 3"
|
||||||
kill %1
|
# Wrap up
|
||||||
|
pkill git-sync
|
||||||
|
wait
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Test rev syncing
|
# Test rev syncing
|
||||||
|
|
@ -310,32 +338,35 @@ testcase "rev-sync"
|
||||||
echo "$TESTCASE 1" > "$REPO"/file
|
echo "$TESTCASE 1" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 1"
|
git -C "$REPO" commit -qam "$TESTCASE 1"
|
||||||
REV=$(git -C "$REPO" rev-list -n1 HEAD)
|
REV=$(git -C "$REPO" rev-list -n1 HEAD)
|
||||||
$GIT_SYNC \
|
GIT_SYNC \
|
||||||
--logtostderr \
|
--logtostderr \
|
||||||
--v=5 \
|
--v=5 \
|
||||||
|
--wait=0.1 \
|
||||||
--repo="$REPO" \
|
--repo="$REPO" \
|
||||||
--rev="$REV" \
|
--rev="$REV" \
|
||||||
--root="$ROOT" \
|
--root="$ROOT" \
|
||||||
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
--dest="link" > "$DIR"/log."$TESTCASE" 2>&1 &
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
# Commit something new
|
# Commit something new
|
||||||
echo "$TESTCASE 2" > "$REPO"/file
|
echo "$TESTCASE 2" > "$REPO"/file
|
||||||
git -C "$REPO" commit -qam "$TESTCASE 2"
|
git -C "$REPO" commit -qam "$TESTCASE 2"
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
# Revert the last change
|
# Revert the last change
|
||||||
git -C "$REPO" reset -q --hard HEAD^
|
git -C "$REPO" reset -q --hard HEAD^
|
||||||
sleep 2
|
sleep 1
|
||||||
assert_link_exists "$ROOT"/link
|
assert_link_exists "$ROOT"/link
|
||||||
assert_file_exists "$ROOT"/link/file
|
assert_file_exists "$ROOT"/link/file
|
||||||
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
assert_file_eq "$ROOT"/link/file "$TESTCASE 1"
|
||||||
kill %1
|
# Wrap up
|
||||||
|
pkill git-sync
|
||||||
|
wait
|
||||||
pass
|
pass
|
||||||
|
|
||||||
echo "Cleaning up $DIR"
|
echo "cleaning up $DIR"
|
||||||
rm -rf "$DIR"
|
rm -rf "$DIR"
|
||||||
Loading…
Reference in New Issue