diff options
author | Miguel Gonzalez <migonzalvar@gmail.com> | 2013-07-12 16:16:39 (GMT) |
---|---|---|
committer | Miguel Gonzalez <migonzalvar@gmail.com> | 2013-07-12 16:16:39 (GMT) |
commit | b4eea385ef79fd770124d55c085e65ab94eafdee (patch) | |
tree | 80fe417a6154ba7308ea13776b35f7f82dca5e55 | |
parent | 11588330e62a0bd34416563e7b1a4623301e8fea (diff) |
Add functional test
-rw-r--r-- | test2/.gitignore | 1 | ||||
-rw-r--r-- | test2/Makefile | 17 | ||||
-rw-r--r-- | test2/crc.sql | 5 | ||||
-rw-r--r-- | test2/crc.txt | 4 | ||||
-rw-r--r-- | test2/test.conf | 8 |
5 files changed, 35 insertions, 0 deletions
diff --git a/test2/.gitignore b/test2/.gitignore new file mode 100644 index 0000000..9af7a80 --- /dev/null +++ b/test2/.gitignore @@ -0,0 +1 @@ +crc_test.txt diff --git a/test2/Makefile b/test2/Makefile new file mode 100644 index 0000000..86e1356 --- /dev/null +++ b/test2/Makefile @@ -0,0 +1,17 @@ +.PHONY: dropdb crc run test + +MYSQL_ARGS=--user=sc --password=sc +MYSQL_CLI=mysql $(MYSQL_ARGS) sc +MYSQL_DUMP=mysqldump $(MYSQL_ARGS) sc + +dropdb: + $(MYSQL_CLI) --execute="DROP DATABASE sc;" + +crc: + $(MYSQL_CLI) --batch < crc.sql > crc_test.txt + diff crc_test.txt crc.txt + +run: + ../stats_consolidation/stats_consolidation_run --config_file test.conf + +test: dropdb run crc diff --git a/test2/crc.sql b/test2/crc.sql new file mode 100644 index 0000000..4fb614f --- /dev/null +++ b/test2/crc.sql @@ -0,0 +1,5 @@ +SELECT "Resources" AS TABLE_NAME, COUNT(*) AS N, CONV(BIT_XOR(CAST(CRC32(name) AS UNSIGNED)), 10, 16) AS CRC FROM Resources GROUP BY 1 +UNION +SELECT "Usages" AS TABLE_NAME, COUNT(*) AS N, CONV(BIT_XOR(CAST(CRC32(user_hash) AS UNSIGNED)), 10, 16) AS CRC FROM Usages GROUP BY 1 +UNION +SELECT "Users" AS TABLE_NAME, COUNT(*) AS N, CONV(BIT_XOR(CAST(CRC32(hash) AS UNSIGNED)), 10, 16) AS CRC FROM Users GROUP BY 1; diff --git a/test2/crc.txt b/test2/crc.txt new file mode 100644 index 0000000..ddc0b00 --- /dev/null +++ b/test2/crc.txt @@ -0,0 +1,4 @@ +TABLE_NAME N CRC +Resources 8 318413DE +Usages 211 6EC1AA8 +Users 1 6EC1AA8 diff --git a/test2/test.conf b/test2/test.conf new file mode 100644 index 0000000..f48a807 --- /dev/null +++ b/test2/test.conf @@ -0,0 +1,8 @@ +[main] +db_user=sc +db_pass=sc +db_name=sc + +rrd_path=/home/migonzalvar/repos/statistics-consolidation/test2/rrd +log_path=/home/migonzalvar/repos/statistics-consolidation/test2/log +log_level=debug |