Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: Add integration tests for rollback
- Loading branch information
Showing
4 changed files
with
62 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
PWD := $(shell pwd) | ||
VERSION ?= $(shell git describe --tag --always) | ||
|
||
PROJECT=github.com/docker/docker/cmd/a2o-migrate | ||
GO_BUILDINFO=-X $(PROJECT).gitVersion=$(VERSION) -X $(PROJECT).buildTime=$(shell date -u +%Y-%m-%dT%H:%M:%SZ) | ||
GO_LDFLAGS=-extldflags "-fno-PIC -static" | ||
GO_BUILDFLAGS=-ldflags '$(GO_LDFLAGS) $(GO_BUILDINFO)' -tags 'osusergo netgo static_build' | ||
|
||
a2o-migrate: clean | ||
go build $(GO_BUILDFLAGS) -o ./$@ ./cli | ||
|
||
test-unit: | ||
go test -cover -v ./... | ||
|
||
test-integration: a2o-migrate test-integration-commit test-integration-failcleanup | ||
|
||
test-integration-commit: | ||
TEST_MODE=commit ./test/integration.sh | ||
|
||
test-integration-failcleanup: | ||
TEST_MODE=failcleanup ./test/integration.sh | ||
|
||
clean: | ||
$(RM) ./a2o-migrate | ||
|
||
all: clean test-unit test-integration | ||
|
||
.PHONY: \ | ||
all \ | ||
clean \ | ||
test-unit \ | ||
test-integration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
cat /etc/os-release | ||
balena-engine info || exit 1 | ||
|
||
# ls -lR /var/lib/balena-engine/ | ||
|
||
./a2o-migrate -version | ||
./a2o-migrate -debug -migrate | ||
./a2o-migrate -debug -commit | ||
|
||
# ls -lR /var/lib/balena-engine/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
cat /etc/os-release | ||
balena-engine info || exit 1 | ||
|
||
# ls -lR /var/lib/balena-engine/ | ||
|
||
./a2o-migrate -version | ||
./a2o-migrate -debug -migrate | ||
|
||
# we mess up the files here intentionally to test the | ||
# rollback path | ||
rm -rf /var/lib/balena-engine/image/overlay/l | ||
|
||
./a2o-migrate -debug -rollback | ||
|
||
# ls -lR /var/lib/balena-engine/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters