-- Cleanup after all pg_jobmon testing

SELECT set_config('search_path', 'jobmon, dblink, public', false);

SELECT plan(1);

DROP FUNCTION IF EXISTS jobmon_test_jobs_normal();
DROP FUNCTION IF EXISTS jobmon_test_jobs_cancel();
DROP FUNCTION IF EXISTS jobmon_test_jobs_running();
DROP FUNCTION IF EXISTS jobmon_test_jobs_blocked();

DROP TABLE IF EXISTS tmp_test;
DROP TABLE IF EXISTS jobmon_block_test_table;

DELETE FROM job_log WHERE job_name IN ('PG_JOBMON TEST GOOD JOB', 'PG_JOBMON TEST WARNING JOB', 'PG_JOBMON TEST BAD JOB', 'PG_JOBMON TEST CANCELED JOB', 'PG_JOBMON TEST SQL JOB', 'PG_JOBMON TEST JOB NEVER FINISHED', 'PG_JOBMON TEST NON-CONFIG BAD JOB', 'PG_JOBMON TEST RUNNING JOB', 'PG_JOBMON TEST BLOCKED JOB');
DELETE FROM job_check_config WHERE job_name IN ('PG_JOBMON TEST GOOD JOB', 'PG_JOBMON TEST WARNING JOB', 'PG_JOBMON TEST BAD JOB', 'PG_JOBMON TEST CANCELED JOB', 'PG_JOBMON TEST SQL JOB', 'PG_JOBMON TEST JOB NEVER RUN', 'PG_JOBMON TEST JOB NEVER FINISHED', 'PG_JOBMON TEST NON-CONFIG BAD JOB', 'PG_JOBMON TEST RUNNING JOB', 'PG_JOBMON TEST BLOCKED JOB');
DELETE FROm job_check_log WHERE job_name IN ('PG_JOBMON TEST GOOD JOB', 'PG_JOBMON TEST WARNING JOB', 'PG_JOBMON TEST BAD JOB', 'PG_JOBMON TEST CANCELED JOB', 'PG_JOBMON TEST SQL JOB', 'PG_JOBMON TEST JOB NEVER FINISHED', 'PG_JOBMON TEST NON-CONFIG BAD JOB');

SELECT pass('Cleanup testing complete');

SELECT * FROM finish();
