Add a test for duplicate message insertion.
Remove an item from the TODO.
2. Write a test for test/xml/Odds_XML-long-import.xml once it no
longer takes 10 minutes to import (Postgres only?).
-3. Write a test for the ON DELETE CASCADE behavior.
-
-4. Add a test for inserting duplicate messages.
+3. Write a test for the ON DELETE CASCADE behavior (newsxml, Odds_XML,
+ weatherxml).
-O2
+-- These won't work without shelltestrunner installed in your
+-- $PATH. Maybe there is some way to tell Cabal that.
+test-suite shelltests
+ type: exitcode-stdio-1.0
+ hs-source-dirs: test
+ main-is: ShellTests.hs
+
+ build-depends:
+ base == 4.*,
+ cmdargs >= 0.10.6,
+ configurator == 0.2.*,
+ directory == 1.2.*,
+ filepath == 1.3.*,
+ hslogger == 1.2.*,
+ htsn-common == 0.0.1,
+ hxt == 9.3.*,
+ groundhog == 0.4.*,
+ groundhog-postgresql == 0.4.*,
+ groundhog-sqlite == 0.4.*,
+ groundhog-th == 0.4.*,
+ MissingH == 1.2.*,
+ old-locale == 1.0.*,
+ process == 1.1.*,
+ tasty == 0.7.*,
+ tasty-hunit == 0.4.*,
+ time == 1.4.*,
+ transformers == 0.3.*,
+ tuple == 0.2.*
+
+
+
source-repository head
type: git
location: http://michael.orlitzky.com/git/htsn-import.git
--- /dev/null
+module Main
+where
+
+import System.Cmd ( system )
+import System.Exit ( exitWith )
+
+main :: IO ()
+main = do
+ result <- system "shelltest test/shell/*.test"
+ exitWith result
--- /dev/null
+#
+# Attempt to import our test XML twice; all attempts after the first
+# should fail.
+#
+
+# First, we remove any leftover mess.
+rm -f shelltest.sqlite3
+>>>= 0
+
+# Now we run the import/migrate silently.
+./dist/build/htsn-import/htsn-import -c 'shelltest.sqlite3' test/xml/*.xml > /dev/null
+>>>= 0
+
+# We note the number of XML files that we have. There's one extra
+# Heartbeat.xml that doesn't really count.
+find ./test/xml -name '*.xml' | wc -l
+>>>
+12
+>>>= 0
+
+# Run the imports again; we should get complaints about the duplicate
+# xml_file_ids. There are 2 errors for each violation, so we expect 2*11
+# occurrences of the string 'ERROR'.
+./dist/build/htsn-import/htsn-import -c 'shelltest.sqlite3' test/xml/*.xml 2>&1 | grep ERROR | wc -l
+>>>
+22
+>>>= 0
+
+# Finally, clean up after ourselves.
+rm -f shelltest.sqlite3
+>>>= 0