]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blob - test/shell/import-duplicates.test
Add database support and tests for TSN.XML.Scores.
[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.
16 find ./test/xml -name '*.xml' | wc -l
17 >>>
18 16
19 >>>= 0
20
21 # Run the imports again; we should get complaints about the duplicate
22 # xml_file_ids. There are 2 errors for each violation, so we expect 2*15
23 # occurrences of the string 'ERROR'.
24 ./dist/build/htsn-import/htsn-import -c 'shelltest.sqlite3' test/xml/*.xml 2>&1 | grep ERROR | wc -l
25 >>>
26 30
27 >>>= 0
28
29 # Finally, clean up after ourselves.
30 rm -f shelltest.sqlite3
31 >>>= 0