From b4449b445e4b635e8024a7e212d9a728982eaa58 Mon Sep 17 00:00:00 2001 From: Hannah Ramadan <76922290+hannahramadan@users.noreply.github.com> Date: Thu, 1 Aug 2024 15:12:20 -0700 Subject: [PATCH] Update instrumentation/pg/test/opentelemetry/instrumentation/pg/instrumentation_test.rb Co-authored-by: Robb Kidd --- .../pg/instrumentation_test.rb | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/instrumentation/pg/test/opentelemetry/instrumentation/pg/instrumentation_test.rb b/instrumentation/pg/test/opentelemetry/instrumentation/pg/instrumentation_test.rb index 5e8d287c1..d3f184451 100644 --- a/instrumentation/pg/test/opentelemetry/instrumentation/pg/instrumentation_test.rb +++ b/instrumentation/pg/test/opentelemetry/instrumentation/pg/instrumentation_test.rb @@ -374,19 +374,21 @@ end end - def self.load_fixture - data = File.read("#{Dir.pwd}/test/fixtures/sql_table_name.json") - JSON.parse(data) - end + describe '#connection_name' do + def self.load_fixture + data = File.read("#{Dir.pwd}/test/fixtures/sql_table_name.json") + JSON.parse(data) + end - load_fixture.each do |test_case| - name = test_case['name'] - query = test_case['sql'] + load_fixture.each do |test_case| + name = test_case['name'] + query = test_case['sql'] - define_method(:"test_sql_table_name_#{name}") do - table_name = client.send(:collection_name, query) + define_method(:"test_sql_table_name_#{name}") do + table_name = client.send(:collection_name, query) - assert('test_table', table_name) + assert_equal('table_name', table_name) # TODO: use an expected name from fixtures or update fixtures to always use "table_name" + end end end end unless ENV['OMIT_SERVICES']