summaryrefslogtreecommitdiff
path: root/tests/bugzillas/bz1033467/runtest.sh
blob: 54ec293dc91ed508ffdc4e33a615dd2a6280aa20 (plain)
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
#!/bin/bash

# Test for https://bugzilla.redhat.com/show_bug.cgi?id=1033467

. ../../prepare.inc.sh
. ../../toolbox.inc.sh


# ---- do the actual testing ----

result=PASS
echo "++++ BEGINNING TEST" >$OUTPUTFILE

# create a keyring and attach it to the session keyring
marker "ADD SANDBOX KEYRING"
create_keyring sandbox @s
expect_keyid sandbox

# create a bunch of nested keyrings in the sandbox
marker "ADD NESTED KEYRINGS"
declare -a ring
for ((i=0; i<=16; i++))
do
    create_keyring ring$i $sandbox
    expect_keyid "ring[$i]"
done

# create a key in each of those keyrings
marker "ADD KEYS"
keys=""
for ((i=0; i<=16; i++))
do
    create_key user a$i a ${ring[$i]}
    expect_keyid id
    keys="$keys $id"
done

# search for the added keys, beginning at sandbox and exercising the nesting
marker "SEARCH KEYS"
keys2=""
for ((i=0; i<=16; i++))
do
    search_for_key $sandbox user a$i
    expect_keyid id
    keys2="$keys2 $id"
done

marker "COMPARE KEY LISTS"
if [ "$keys" != "$keys2" ]
then
	echo "Key lists differ" >>$OUTPUTFILE
	echo List 1: "\"$keys\"" >>$OUTPUTFILE
	echo List 2: "\"$keys2\"" >>$OUTPUTFILE
	failed
fi

# search for some unadded keys and make sure we get an error
marker "SEARCH MISSES"
for ((i=17; i<=20; i++))
do
    search_for_key --fail $sandbox user a$i
    expect_error ENOKEY
done

echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE

# --- then report the results in the database ---
toolbox_report_result $TEST $result