Skip to content

Commit c24c3f7

Browse files
authored
Merge pull request #135 from elainemccloskey/SUP-2842
(SUP-2842) Add test for st0287_check_db_table_sizes
2 parents 7c2b977 + fdc4322 commit c24c3f7

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'spec_helper_acceptance'
2+
describe 'tasks' do
3+
it 'table sizes output sucessfully' do
4+
result = run_bolt_task('support_tasks::st0287_check_db_table_sizes', 'dbname' => 'all')
5+
expect(result.stdout).to contain(%r{success})
6+
end
7+
end

tasks/st0287_check_db_table_sizes.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"description": "The name of the db to connect to",
88
"type": "Enum['pe-puppetdb', 'pe-postgres', 'pe-classifier', 'pe-rbac', 'pe-activity', 'pe-orchestrator', 'postgres', all]"
99
}
10-
}
10+
},
11+
"implementations": [
12+
{"name": "st0287_check_db_table_sizes.sh", "requirements": ["shell"], "files": ["bash_task_helper/files/task_helper.sh"], "input_method": "environment"}
13+
]
1114
}

tasks/st0287_check_db_table_sizes.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
declare PT_dbname
66
dbname=$PT_dbname
7+
declare PT__installdir
8+
source "$PT__installdir/bash_task_helper/files/task_helper.sh"
79

810
function getdbTables() {
911
path=$1
@@ -36,7 +38,7 @@ elif puppet resource service postgresql-* | grep -q running; then
3638
dbname="puppetdb"
3739
fi
3840
else
39-
echo "Node not running pe-postgresql or postgresql service, please select node which is."
41+
success '{ "status": "success - Node not running pe-postgresql or postgresql service, please select node which is." }'
4042
fi
4143

4244
#Run for the correct environment
@@ -51,8 +53,7 @@ fi
5153
getdbTables "psql" "${dbname}" "${postgresservice}" "puppetdb"
5254
;;
5355
*)
54-
echo "Cannot Determine if Puppet Enterprise or Puppet Open Source "
55-
exit 1
56+
fail "Cannot Determine if Puppet Enterprise or Puppet Open Source"
5657
esac
5758

58-
echo " -- ST#0287 Task ended: $(date +%s) --"
59+
success '{ "status": "success - Task completed" }'

0 commit comments

Comments
 (0)