]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blob - test/shell/import-duplicates.test
d2ea767f65dabb1f6bdf11c76d87edd3bbec82a4
[dead/htsn-import.git] / test / shell / import-duplicates.test
1 #
2 # Attempt to import our test XML twice; all attempts after the first
3 # should fail.
4 #
5
6 # First, we remove any leftover mess.
7 rm -f shelltest.sqlite3
8 >>>= 0
9
10 # Now we run the import/migrate silently.
11 ./dist/build/htsn-import/htsn-import -c 'shelltest.sqlite3' test/xml/*.xml > /dev/null
12 >>>= 0
13
14 # We note the number of XML files that we have. There's one extra
15 # Heartbeat.xml that doesn't really count. There are also 2 weatherxml
16 # and a newsxml that aren't really supposed to import.
17 find ./test/xml -maxdepth 1 -name '*.xml' | wc -l
18 >>>
19 38
20 >>>= 0
21
22 # Run the imports again; we should get complaints about the duplicate
23 # xml_file_ids. There are 2 errors for each violation, so we expect 2*28
24 # occurrences of the string 'ERROR'.
25 ./dist/build/htsn-import/htsn-import -c 'shelltest.sqlite3' test/xml/*.xml 2>&1 | grep ERROR | wc -l
26 >>>
27 68
28 >>>= 0
29
30 # Finally, clean up after ourselves.
31 rm -f shelltest.sqlite3
32 >>>= 0