Skip to content

Commit

Permalink
[oracle][test] setup test, just play with DB a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
truthbk committed Aug 28, 2017
1 parent 98316c5 commit a543bd5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions oracle/test_oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# 3p
from nose.plugins.attrib import attr
import cx_Oracle

# project
from tests.checks.common import AgentCheckTest
Expand Down Expand Up @@ -68,6 +69,28 @@ class TestOracle(AgentCheckTest):
"""Basic Test for oracle integration."""
CHECK_NAME = 'oracle'

def setUp(self):
conn_string = "cx_Oracle/welcome@//localhost:1521/xe
connection = cx_Oracle.connect(conn_string)

# mess around a bit to pupulate metrics
cursor = connection.cursor()
cursor.execute("select 'X' from dual")

# truncate
cursor.execute("truncate table TestTempTable")

# insert
rows = [ { u"value" : n } for n in range(250) ]
cursor.arraysize = 100
statement = "insert into TestTempTable (IntCol) values (:value)"
cursor.executemany(statement, rows)
connection.commit()

# select
cursor.execute("select count(*) from TestTempTable")
_, = cursor.fetchone()

def testOracle(self):
self.run_check_twice(CONFIG)

Expand Down

0 comments on commit a543bd5

Please sign in to comment.