ossc-db / pgaudit

PostgreSQL Audit Extension
Other
2 stars 4 forks source link

add regression test for database name filtering rule. #6

Closed ooyamams closed 8 years ago

MasahikoSawada commented 8 years ago

Thank you for the PR!

I got error when I run the regression test.

/home/masahiko/pgsql/master/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/home/masahiko/pgsql/master/bin'    --temp-instance=./tmp_check --dbname=contrib_regression filter_database
============== removing existing temp instance        ==============
============== creating temporary instance            ==============
============== initializing database system           ==============
============== starting postmaster                    ==============
running on port 57832 with PID 13870
============== creating database "contrib_regression" ==============
CREATE DATABASE
ALTER DATABASE
============== running regression test queries        ==============
test filter_database          ... diff command failed with status 512: diff  "/home/masahiko/pgsql/source/pgaudit/expected/filter_database.out" "/home/masahiko/pgsql/source/pgaudit/results/filter_database.out" > "/home/masahiko/pgsql/source/pgaudit/results/filter_database.out.diff"
make: *** [installcheck] Error 2

$ cat /home/masahiko/pgsql/source/pgaudit/expected/filter_database.out
LOG:  AUDIT: SESSION,1,1,READ,SELECT,,SELECT 1,<not logged>
$ cat /home/masahiko/pgsql/source/pgaudit/results/filter_database.out
grep: ./tmp_check/tmp_check.log: No such file or directory

ISTM that the following line doesn't work fine.

+\!` grep "AUDIT:" ./tmp_check/tmp_check.log > results/filter_database.out

And I think that it's better to gather all files regarding fileter_databse into one directory. Thought?

ooyamams commented 8 years ago

mmm. Is there tmp_check directory? my environment is there.

$ cat /home/masanori/postgres-audit/contrib/pgaudit/tmp_check/tmp_check.log 
...
LOG:  AUDIT: SESSION,1,1,READ,SELECT,,SELECT 1,<not logged>
...

And I think that it's better to gather all files regarding fileter_databse into one directory. Thought?

I think splitting directory is better. ISTM a newbie developer can understand test framework easy. Actually I was so.

MasahikoSawada commented 8 years ago

This regression test is assumed that PATH environment variable is already set. In my environment, pg_ctl restart in sql/filter_database.sql doesn't work.

This patch has a whitespace problem, please run git show --check or git diff refactored --check

If class = 'all', the system audit log, for example starting up log, would be emitted as well, and regression test would be fails.

MasahikoSawada commented 8 years ago

Merged regression test with #11 approach, so close this.