mirror of
https://github.com/mudler/luet.git
synced 2025-08-18 23:36:56 +00:00
Add integration tests
This commit is contained in:
parent
efdfe72568
commit
62ebe1a82b
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
|||||||
*.swp
|
*.swp
|
||||||
luet
|
luet
|
||||||
|
tests/integration/shunit2
|
||||||
|
tests/integration/bin
|
6
Makefile
6
Makefile
@ -21,6 +21,10 @@ test:
|
|||||||
GO111MODULE=off go get github.com/onsi/gomega/...
|
GO111MODULE=off go get github.com/onsi/gomega/...
|
||||||
ginkgo -race -r ./...
|
ginkgo -race -r ./...
|
||||||
|
|
||||||
|
.PHONY: test-integration
|
||||||
|
test-integration:
|
||||||
|
tests/integration/run.sh
|
||||||
|
|
||||||
.PHONY: coverage
|
.PHONY: coverage
|
||||||
coverage:
|
coverage:
|
||||||
go test ./... -race -coverprofile=coverage.txt -covermode=atomic
|
go test ./... -race -coverprofile=coverage.txt -covermode=atomic
|
||||||
@ -36,6 +40,8 @@ help:
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -rf release/
|
rm -rf release/
|
||||||
|
rm -rf tests/integration/shunit2
|
||||||
|
rm -rf tests/integration/bin
|
||||||
|
|
||||||
.PHONY: deps
|
.PHONY: deps
|
||||||
deps:
|
deps:
|
||||||
|
48
tests/integration/01_simple.sh
Executable file
48
tests/integration/01_simple.sh
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
export LUET_NOLOCK=true
|
||||||
|
|
||||||
|
oneTimeSetUp() {
|
||||||
|
export tmpdir="$(mktemp -d)"
|
||||||
|
}
|
||||||
|
|
||||||
|
oneTimeTearDown() {
|
||||||
|
rm -rf "$tmpdir"
|
||||||
|
}
|
||||||
|
|
||||||
|
testBuild() {
|
||||||
|
mkdir $tmpdir/testbuild
|
||||||
|
luet build --tree "$ROOT_DIR/tests/fixtures/buildableseed" --destination $tmpdir/testbuild --compression gzip test/c-1.0
|
||||||
|
buildst=$?
|
||||||
|
assertEquals 'builds successfully' "$buildst" "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
testRepo() {
|
||||||
|
luet create-repo --tree "$ROOT_DIR/tests/fixtures/buildableseed" \
|
||||||
|
--output $tmpdir/testbuild \
|
||||||
|
--packages $tmpdir/testbuild \
|
||||||
|
--name "test" \
|
||||||
|
--uri $tmpdir/testrootfs \
|
||||||
|
--type local
|
||||||
|
|
||||||
|
createst=$?
|
||||||
|
assertEquals 'create repo successfully' "$createst" "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
testInstall() {
|
||||||
|
mkdir $tmpdir/testrootfs
|
||||||
|
cat <<EOF > $tmpdir/luet.yaml
|
||||||
|
system-repositories:
|
||||||
|
- name: "main"
|
||||||
|
type: "local"
|
||||||
|
uri: "$tmpdir/testbuild"
|
||||||
|
EOF
|
||||||
|
luet install --config $tmpdir/luet.yaml --system-dbpath $tmpdir/testrootfs --system-target $tmpdir/testrootfs test/c-1.0
|
||||||
|
installst=$?
|
||||||
|
assertEquals 'install test successfully' "$installst" "0"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Load shUnit2.
|
||||||
|
. "$ROOT_DIR/tests/integration/shunit2"/shunit2
|
||||||
|
|
15
tests/integration/run.sh
Executable file
15
tests/integration/run.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export ROOT_DIR="$(git rev-parse --show-toplevel)"
|
||||||
|
|
||||||
|
pushd $ROOT_DIR
|
||||||
|
go build -o "$ROOT_DIR/tests/integration/bin/luet"
|
||||||
|
popd
|
||||||
|
|
||||||
|
[ ! -d "$ROOT_DIR/tests/integration/shunit2" ] && git clone https://github.com/kward/shunit2.git "$ROOT_DIR/tests/integration/shunit2"
|
||||||
|
|
||||||
|
export PATH=$ROOT_DIR/tests/integration/bin/:$PATH
|
||||||
|
|
||||||
|
"$ROOT_DIR/tests/integration/01_simple.sh"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user