Renaming oracle_session to oracledb_session

Signed-off-by: Nolan Davidson <ndavidson@chef.io>
This commit is contained in:
Nolan Davidson 2017-05-05 13:11:07 -04:00
parent 55beed4bc8
commit ba6745444e
4 changed files with 16 additions and 16 deletions

View file

@ -1,22 +1,22 @@
---
title: About the oracle_session Resource
title: About the oracledb_session Resource
---
# oracle_session
# oracledb_session
Use the `oracle_session` InSpec audit resource to test SQL commands run against a Oracle database.
Use the `oracledb_session` InSpec audit resource to test SQL commands run against a Oracle database.
## Syntax
A `oracle_session` resource block declares the username and password to use for the session with an optional service to connect to, and then the command to be run:
A `oracledb_session` resource block declares the username and password to use for the session with an optional service to connect to, and then the command to be run:
describe oracle_session(user: 'username', pass: 'password').query('QUERY') do
describe oracledb_session(user: 'username', pass: 'password').query('QUERY') do
its('output') { should eq('') }
end
where
* `oracle_session` declares a username and password with permission to run the query (required), and an optional parameters for host (default: `localhost`), SID (default: `nil`, which uses the default SID, and path to the sqlplus binary (default: `sqlplus`).
* `oracledb_session` declares a username and password with permission to run the query (required), and an optional parameters for host (default: `localhost`), SID (default: `nil`, which uses the default SID, and path to the sqlplus binary (default: `sqlplus`).
* `query('QUERY')` contains the query to be run
* `its('output') { should eq('') }` compares the results of the query against the expected result in the test
@ -56,7 +56,7 @@ The following examples show how to use this InSpec audit resource.
### Test for matching databases
sql = oracle_session(user: 'my_user', pass: 'password')
sql = oracledb_session(user: 'my_user', pass: 'password')
describe sql.query('SELECT NAME FROM v$database;') do
its('stdout') { should_not match(/test/) }
@ -64,7 +64,7 @@ The following examples show how to use this InSpec audit resource.
### Test for matching databases with custom host, SID and sqlplus binary location
sql = oracle_session(user: 'my_user', pass: 'password', host: 'oraclehost', sid: 'mysid', sqlplus_bin: '/u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus')
sql = oracledb_session(user: 'my_user', pass: 'password', host: 'oraclehost', sid: 'mysid', sqlplus_bin: '/u01/app/oracle/product/12.1.0/dbhome_1/bin/sqlplus')
describe sql.query('SELECT NAME FROM v$database;') do
its('stdout') { should_not match(/test/) }

View file

@ -114,7 +114,7 @@ require 'resources/mysql_session'
require 'resources/npm'
require 'resources/ntp_conf'
require 'resources/oneget'
require 'resources/oracle_session'
require 'resources/oracledb_session'
require 'resources/os'
require 'resources/os_env'
require 'resources/package'

View file

@ -3,11 +3,11 @@
# license: All rights reserved
module Inspec::Resources
class OracleSession < Inspec.resource(1)
name 'oracle_session'
desc 'Use the oracle_session InSpec resource to test commands against an Oracle database'
class OracledbSession < Inspec.resource(1)
name 'oracledb_session'
desc 'Use the oracledb_session InSpec resource to test commands against an Oracle database'
example "
sql = oracle_session(user: 'my_user', pass: 'password')
sql = oracledb_session(user: 'my_user', pass: 'password')
describe sql.query('SELECT NAME FROM v$database;') do
its('stdout') { should_not match(/test/) }
end

View file

@ -3,9 +3,9 @@
require 'helper'
describe 'Inspec::Resources::OracleSession' do
it 'verify oracle_session configuration' do
resource = load_resource('oracle_session', user: 'myuser', pass: 'mypass', host: 'oraclehost', sid: 'mysid')
describe 'Inspec::Resources::OracledbSession' do
it 'verify oracledb_session configuration' do
resource = load_resource('oracledb_session', user: 'myuser', pass: 'mypass', host: 'oraclehost', sid: 'mysid')
_(resource.user).must_equal 'myuser'
_(resource.pass).must_equal 'mypass'
_(resource.host).must_equal 'oraclehost'