Skip to content

Commit c989018

Browse files
authored
tests: revert "tests: disable second special character case for prompting integration tests" (#16931)
The second prompt in the sequence was being parsed incorrectly by the scripted prompting-client, causing it to expect a prompt with the incorrect interface. canonical/prompting-client#306 resolved this issue and the test case can now be re-enabled This reverts commit a6225d3. Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
1 parent f4fc7bd commit c989018

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

tests/main/apparmor-prompting-integration-tests/special_characters.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,23 @@
2323
"permissions": [ "read" ]
2424
}
2525
}
26+
},
27+
{
28+
"prompt-filter": {
29+
"constraints": {
30+
"path": "${BASE_PATH}/foo\\\\\\*\\\\\\?\\(\\)\\\\\\[\\\\\\]\\\\\\{\\\\\\}\\\\\\\\\\\\\\\\",
31+
"path": "${BASE_PATH}/foo\\\\\\*\\\\\\?\\(\\)\\\\\\[\\\\\\]\\\\\\{\\\\\\}\\\\\\\\",
32+
"requested-permissions": [ "read" ]
33+
}
34+
},
35+
"reply": {
36+
"action": "allow",
37+
"lifespan": "single",
38+
"constraints": {
39+
"path-pattern": "${BASE_PATH}/foo\\*\\?()\\[\\]\\{\\}\\\\",
40+
"permissions": [ "read" ]
41+
}
42+
}
2643
}
2744
]
2845
}

tests/main/apparmor-prompting-integration-tests/special_characters.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,8 @@ echo "$SECOND_CONTENT" | tee "${TEST_DIR}/foo*?()[]{}\\"
2121
echo "Attempt to read the first file"
2222
FIRST_OUTPUT="$(snap run --shell prompt-requester.home -c "cat ${TEST_DIR}/'[アニメ][ゲーム動画].mkv'")"
2323

24-
echo "Skip reading the second file as there's an issue with the prompting-client.scripted parsing the sequence"
25-
# TODO: actually do the second read
26-
#echo "Attempt to read the second file"
27-
#SECOND_OUTPUT="$(snap run --shell prompt-requester.home -c "cat ${TEST_DIR}/'foo*?()[]{}\\'")"
24+
echo "Attempt to read the second file"
25+
SECOND_OUTPUT="$(snap run --shell prompt-requester.home -c "cat ${TEST_DIR}/'foo*?()[]{}\\'")"
2826

2927
# Wait for the client to write its result and exit
3028
for i in $(seq "$TIMEOUT") ; do
@@ -51,8 +49,7 @@ if [ "$FIRST_OUTPUT" != "$FIRST_CONTENT" ] ; then
5149
exit 1
5250
fi
5351

54-
# TODO: actually check the second output
55-
#if [ "$SECOND_OUTPUT" != "$SECOND_CONTENT" ] ; then
56-
# echo "test script failed"
57-
# exit 1
58-
#fi
52+
if [ "$SECOND_OUTPUT" != "$SECOND_CONTENT" ] ; then
53+
echo "test script failed"
54+
exit 1
55+
fi

0 commit comments

Comments
 (0)