Skip to content

Commit

Permalink
test: close client after test runs
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahramadan committed Jul 24, 2024
1 parent f9ac292 commit 401e3fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions instrumentation/pg/test/fixtures/sql_table_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"name": "insert_into",
"sql": "INSERT INTO table_name (column1, column2) VALUES (value1, value2)"
},
{
"name": "drop_table",
"sql": "DROP TABLE table_name"
},
{
"name": "update",
"sql": "UPDATE table_name SET column1 = value1 WHERE condition"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
after do
# Force re-install of instrumentation
instrumentation.instance_variable_set(:@installed, false)
client&.close
end

describe 'tracing' do
Expand Down Expand Up @@ -268,9 +269,10 @@
end

it 'extracts table name' do
client.query('CREATE TABLE IF NOT EXISTS test_table (personid int, name VARCHAR(50))')
client.query('CREATE TABLE test_table (personid int, name VARCHAR(50))')

_(span.attributes['db.collection.name']).must_equal 'test_table'
client.query('DROP TABLE test_table') # Drop table to avoid conflicts
end

describe 'when db_statement is obfuscate' do
Expand Down

0 comments on commit 401e3fc

Please sign in to comment.