Skip to content

Commit 6556153

Browse files
committed
testsuite: test legacy filemap and stage-in options
Problem: there are no tests for flux-filemap or for stage-in.tags. Add a sharness test for flux-filemap. The tests are not mixed in with those of flux-archive so they can be more easily removed when we decide to drop backwards compatibility. Add a test for to t2617-job-shell-stage-in.t for the tags option. Also, check that unknown options are detected rather than ignored.
1 parent 99effb0 commit 6556153

File tree

3 files changed

+106
-0
lines changed

3 files changed

+106
-0
lines changed

t/Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ TESTSCRIPTS = \
8080
t0030-marshall.t \
8181
t0031-constraint-parser.t \
8282
t0032-directives-parser.t \
83+
t0033-filemap-cmd.t \
8384
t0025-broker-state-machine.t \
8485
t0027-broker-groups.t \
8586
t0013-config-file.t \

t/t0033-filemap-cmd.t

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#!/bin/sh
2+
3+
test_description='Test flux-filemap'
4+
5+
. `dirname $0`/content/content-helper.sh
6+
7+
. `dirname $0`/sharness.sh
8+
9+
LPTEST=${FLUX_BUILD_DIR}/t/shell/lptest
10+
11+
test_under_flux 2 kvs
12+
13+
umask 022
14+
15+
# Usage: list_mapped_files tag
16+
list_mapped_files() {
17+
flux module stats content | jq -r ".mmap.tags[\"$1\"][]"
18+
}
19+
20+
test_expect_success 'create copy directory' '
21+
mkdir -p copydir
22+
'
23+
test_expect_success 'create test file' '
24+
${LPTEST} >testfile &&
25+
chmod u=rwx testfile &&
26+
chmod go=r testfile
27+
'
28+
test_expect_success 'flux filemap map works' '
29+
flux filemap map ./testfile &&
30+
flux kvs get --raw archive.main | jq
31+
'
32+
test_expect_success 'content stats show mapped file' '
33+
list_mapped_files main >stats.out &&
34+
realpath ./testfile >stats.exp &&
35+
test_cmp stats.exp stats.out
36+
'
37+
test_expect_success 'flux filemap list works' '
38+
flux filemap list
39+
'
40+
test_expect_success 'flux filemap list --long works' '
41+
flux filemap list --long
42+
'
43+
test_expect_success 'flux filemap get works' '
44+
flux filemap get -C copydir
45+
'
46+
test_expect_success 'file content is correct' '
47+
test_cmp testfile copydir/testfile
48+
'
49+
test_expect_success 'flux filemap umap works' '
50+
flux filemap unmap
51+
'
52+
test_expect_success 'content stats no longer show mapped file' '
53+
test_must_fail list_mapped_files archive.main
54+
'
55+
test_expect_success 'flux filemap map --disable-mmap -Too works' '
56+
flux filemap map --disable-mmap -Tfoo ./testfile &&
57+
flux kvs get --raw archive.foo | jq
58+
'
59+
test_expect_success 'flux filemap list -Tfoo works' '
60+
flux filemap list -Tfoo
61+
'
62+
test_expect_success 'flux filemap get -Tfoo works' '
63+
rm -f copydir/* &&
64+
flux filemap get -C copydir -Tfoo 2>warn.err
65+
'
66+
test_expect_success 'with warning printed on stderr' '
67+
grep deprecated warn.err
68+
'
69+
test_expect_success 'file content is correct' '
70+
test_cmp testfile copydir/testfile
71+
'
72+
test_expect_success 'flux filemap unmap -Tfoo works' '
73+
flux filemap unmap -Tfoo
74+
'
75+
test_expect_success 'flux filemap list no longer works' '
76+
test_must_fail flux filemap list -Tfoo
77+
'
78+
test_expect_success 'flux filemap create does not accept -T' '
79+
test_must_fail flux archive create -T bar ./testfile
80+
'
81+
test_expect_success 'flux filemap create does not accept --disable-mmap' '
82+
test_must_fail flux archive create --disable-mmap ./testfile
83+
'
84+
test_expect_success 'flux archive create --name=bar works' '
85+
flux archive create --name=bar ./testfile
86+
'
87+
test_expect_success 'flux filemap extract does not accept -T' '
88+
test_must_fail flux archive extract -T bar
89+
'
90+
test_expect_success 'flux filemap remove does not accept -T' '
91+
test_must_fail flux archive remove -T bar
92+
'
93+
test_done

t/t2617-job-shell-stage-in.t

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ test_expect_success 'verify that stage-in works with names=red' '
5252
test_expect_success 'verify that stage-in works with names=red,blue' '
5353
flux run -N1 -ostage-in.names=red,blue ./check.sh red blue
5454
'
55+
test_expect_success 'verify that stage-in works with deprecated tags option' '
56+
flux run -N1 -ostage-in.tags=red,blue ./check.sh red blue 2>depr.err
57+
'
58+
test_expect_success 'and deprecation warning was printed' '
59+
grep deprecated depr.err
60+
'
61+
test_expect_success 'verify that stage-in fails with unknown option' '
62+
test_must_fail flux run -N1 -ostage-in.badopt /bin/true
63+
'
64+
test_expect_success 'verify that stage-in fails with unknown archive name' '
65+
test_must_fail flux run -N1 -ostage-in.names=badarchive /bin/true
66+
'
5567
test_expect_success 'verify that stage-in.pattern works' '
5668
flux run -N1 \
5769
-ostage-in.names=red,blue \

0 commit comments

Comments
 (0)