-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-test-all
executable file
·61 lines (49 loc) · 1.61 KB
/
docker-test-all
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh -ef
# Test 1: create new repo from scratch and test installing packages
test_new_repo()
{
echo '# Test 1'
rm -rf test/repo1
mkdir -p test/repo1
# Create repo1 with 2 packages
echo '## Create repo1'
REPO_DIR=test/repo1 \
PKGS_SRC="all_pkgs/kaitai-struct-compiler_0.7_all.deb all_pkgs/kaitai-struct-compiler_0.8_all.deb" \
./docker-repo-apt-handle
# Try installing a package
echo '## Test package install from repo1'
REPO_DIR=test/repo1 ./docker-test-pkg-install >test/repo1-install.out
if grep -q 'kaitai-struct-compiler 0.8' test/repo1-install.out; then
echo "## Test 1: OK"
else
echo "## Test 1: FAILED"
echo 'Failed to install kaitai-struct-compiler 0.8, see `test/repo1-install.out`'
exit 1
fi
}
# Test 2: take existing repo and add a new package
test_update_repo()
{
echo '# Test 2'
rm -rf test/repo2
mkdir -p test/repo2
# Simulate repo2 by copying parts of repo1 that we will download from storage account
mkdir -p test/repo2/dists/stable/main/binary-all
cp test/repo1/dists/stable/main/binary-all/Packages.gz test/repo2/dists/stable/main/binary-all
# Fill in the rest of the repo2
REPO_DIR=test/repo2 \
PKGS_SRC="all_pkgs/kaitai-struct-compiler_0.9_all.deb" \
./docker-repo-apt-handle
# Try installing a package
echo '## Test package install from repo2'
REPO_DIR=test/repo2 ./docker-test-pkg-install >test/repo2-install.out
if grep -q 'kaitai-struct-compiler 0.9' test/repo2-install.out; then
echo "## Test 2: OK"
else
echo "## Test 2: FAILED"
echo 'Failed to install kaitai-struct-compiler 0.9, see `test/repo2-install.out`'
exit 1
fi
}
test_new_repo
test_update_repo