File: test-subset.sh

package info (click to toggle)
flatpak 1.17.3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 13,508 kB
  • sloc: ansic: 104,079; xml: 12,184; sh: 5,297; python: 2,315; yacc: 1,236; makefile: 84; csh: 20
file content (114 lines) | stat: -rw-r--r-- 5,828 bytes parent folder | download | duplicates (6)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#!/bin/bash
#
# Copyright (C) 2020 Alexander Larsson <alexl@redhat.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.

set -euo pipefail

. $(dirname $0)/libtest.sh

skip_without_bwrap
skip_revokefs_without_fuse

echo "1..3"

EXPORT_ARGS="--subset=subset1 --subset=subset2" setup_repo

$FLATPAK repo repos/test > repo-info.txt
assert_file_has_content repo-info.txt "Subsummaries: .*subset1-$ARCH.*"
assert_file_has_content repo-info.txt "Subsummaries: .*subset2-$ARCH.*"

$FLATPAK repo --branches repos/test > repo-all.txt
assert_file_has_content repo-all.txt "app/org\.test\.Hello/$ARCH/master"
assert_file_has_content repo-all.txt "runtime/org\.test\.Platform/$ARCH/master"

EXPORT_ARGS="--subset=subset1 " GPGARGS="${FL_GPGARGS}" $(dirname $0)/make-test-app.sh repos/test org.test.SubsetOne master ""
EXPORT_ARGS="--subset=subset2 " GPGARGS="${FL_GPGARGS}" $(dirname $0)/make-test-app.sh repos/test org.test.SubsetTwo master ""
EXPORT_ARGS="" GPGARGS="${FL_GPGARGS}" $(dirname $0)/make-test-app.sh repos/test org.test.NoSubset master ""
${FLATPAK} build-update-repo ${BUILD_UPDATE_REPO_FLAGS-} ${FL_GPGARGS} repos/test >&2

$FLATPAK repo repos/test > repo-info.txt
assert_file_has_content repo-info.txt "Subsummaries: .*subset1-$ARCH.*"
assert_file_has_content repo-info.txt "Subsummaries: .*subset2-$ARCH.*"

$FLATPAK repo --branches repos/test > repo-all.txt
assert_file_has_content repo-all.txt "app/org\.test\.Hello/$ARCH/master"
assert_file_has_content repo-all.txt "app/org\.test\.SubsetOne/$ARCH/master"
assert_file_has_content repo-all.txt "app/org\.test\.SubsetTwo/$ARCH/master"
assert_file_has_content repo-all.txt "app/org\.test\.NoSubset/$ARCH/master"
assert_file_has_content repo-all.txt "runtime/org\.test\.Platform/$ARCH/master"

$FLATPAK repo --branches repos/test --subset=subset1 > repo-subset1.txt
assert_file_has_content repo-subset1.txt "app/org\.test\.Hello/$ARCH/master"
assert_file_has_content repo-subset1.txt "app/org\.test\.SubsetOne/$ARCH/master"
assert_not_file_has_content repo-subset1.txt "app/org\.test\.SubsetTwo/$ARCH/master"
assert_not_file_has_content repo-subset1.txt "app/org\.test\.NoSubset/$ARCH/master"
assert_file_has_content repo-subset1.txt "runtime/org\.test\.Platform/$ARCH/master"

$FLATPAK repo --branches repos/test --subset=subset2 > repo-subset2.txt
assert_file_has_content repo-subset2.txt "app/org\.test\.Hello/$ARCH/master"
assert_not_file_has_content repo-subset2.txt "app/org\.test\.SubsetOne/$ARCH/master"
assert_file_has_content repo-subset2.txt "app/org\.test\.SubsetTwo/$ARCH/master"
assert_not_file_has_content repo-subset2.txt "app/org\.test\.NoSubset/$ARCH/master"
assert_file_has_content repo-subset2.txt "runtime/org\.test\.Platform/$ARCH/master"

ok "repo has right refs in right subset"

${FLATPAK} ${U} remote-modify --subset=subset1 test-repo >&2

${FLATPAK} ${U} remote-ls --columns=ref test-repo > remote-subset1.txt
assert_file_has_content remote-subset1.txt "org\.test\.Hello/"
assert_file_has_content remote-subset1.txt "org\.test\.SubsetOne/"
assert_not_file_has_content remote-subset1.txt "org\.test\.SubsetTwo/"
assert_not_file_has_content remote-subset1.txt "org\.test\.NoSubset/"
assert_file_has_content remote-subset1.txt "org\.test\.Platform/"

${FLATPAK} ${U} install -y org.test.Hello &> /dev/null
${FLATPAK} ${U} install -y org.test.SubsetOne &> /dev/null

if ${FLATPAK} ${U} install -y org.test.SubsetTwo &> /dev/null; then
    assert_not_reached "Subset2 should not be visible"
fi

${FLATPAK} ${U} update --appstream >&2
assert_has_file $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml
assert_file_has_content $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml org.test.Hello.desktop
assert_file_has_content $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml org.test.SubsetOne.desktop
assert_not_file_has_content $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml org.test.SubsetTwo.desktop
assert_not_file_has_content $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml org.test.NoSubset.desktop

ok "remote subset handling works"

${FLATPAK} ${U} remote-modify --subset=subset2 test-repo >&2

${FLATPAK} ${U} remote-ls --columns=ref test-repo > remote-subset2.txt
assert_file_has_content remote-subset2.txt "org\.test\.Hello/"
assert_not_file_has_content remote-subset2.txt "org\.test\.SubsetOne/"
assert_file_has_content remote-subset2.txt "org\.test\.SubsetTwo/"
assert_not_file_has_content remote-subset1.txt "org\.test\.NoSubset/"
assert_file_has_content remote-subset2.txt "org\.test\.Platform/"

${FLATPAK} ${U} install -y org.test.SubsetTwo &> /dev/null

${FLATPAK} ${U} update --appstream >&2
assert_has_file $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml
assert_file_has_content $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml org.test.Hello.desktop
assert_not_file_has_content $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml org.test.SubsetOne.desktop
assert_file_has_content $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml org.test.SubsetTwo.desktop
assert_not_file_has_content $FL_DIR/appstream/test-repo/$ARCH/active/appstream.xml org.test.NoSubset.desktop

ok "remote subset switching works"