diff --git a/src/query-performance-monitoring/common-utils/commmon-helpers_test.go b/src/query-performance-monitoring/common-utils/commmon-helpers_test.go index 4eb2a424..d53199fe 100644 --- a/src/query-performance-monitoring/common-utils/commmon-helpers_test.go +++ b/src/query-performance-monitoring/common-utils/commmon-helpers_test.go @@ -5,7 +5,7 @@ import ( "time" "github.com/newrelic/nri-postgresql/src/collection" - "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils" + commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils" "github.com/stretchr/testify/assert" ) diff --git a/src/query-performance-monitoring/common-utils/ingestion-helper_test.go b/src/query-performance-monitoring/common-utils/ingestion-helper_test.go index 40a971d0..c10bd72f 100644 --- a/src/query-performance-monitoring/common-utils/ingestion-helper_test.go +++ b/src/query-performance-monitoring/common-utils/ingestion-helper_test.go @@ -5,7 +5,7 @@ import ( "github.com/newrelic/infra-integrations-sdk/v3/integration" "github.com/newrelic/nri-postgresql/src/args" - "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils" + commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils" "github.com/stretchr/testify/assert" ) diff --git a/src/query-performance-monitoring/common-utils/query-fetch-helpers_test.go b/src/query-performance-monitoring/common-utils/query-fetch-helpers_test.go index 64777d5f..b2b9bbe8 100644 --- a/src/query-performance-monitoring/common-utils/query-fetch-helpers_test.go +++ b/src/query-performance-monitoring/common-utils/query-fetch-helpers_test.go @@ -1,9 +1,10 @@ package commonutils_test import ( - commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils" "testing" + commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils" + "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/queries" "github.com/stretchr/testify/assert" ) diff --git a/src/query-performance-monitoring/performance-metrics/blocking_sessions.go b/src/query-performance-monitoring/performance-metrics/blocking_sessions.go index 4474fe46..ebe0c398 100644 --- a/src/query-performance-monitoring/performance-metrics/blocking_sessions.go +++ b/src/query-performance-monitoring/performance-metrics/blocking_sessions.go @@ -2,6 +2,7 @@ package performancemetrics import ( "fmt" + "github.com/newrelic/infra-integrations-sdk/v3/integration" commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils" "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/validations" diff --git a/src/query-performance-monitoring/performance-metrics/blocking_sessions_test.go b/src/query-performance-monitoring/performance-metrics/blocking_sessions_test.go index 1fd52dc9..e1f37256 100644 --- a/src/query-performance-monitoring/performance-metrics/blocking_sessions_test.go +++ b/src/query-performance-monitoring/performance-metrics/blocking_sessions_test.go @@ -83,12 +83,10 @@ func TestPopulateBlockingMetricsExtensionsNotEnabled(t *testing.T) { } func TestGetBlockingMetrics(t *testing.T) { - conn, mock := connection.CreateMockSQL(t) args := args.ArgumentList{QueryCountThreshold: 10} databaseName := "testdb" version := uint64(13) - expectedQuery := queries.BlockingQueriesForV12AndV13 query := fmt.Sprintf(expectedQuery, databaseName, min(args.QueryCountThreshold, commonutils.MaxQueryThreshold)) mock.ExpectQuery(regexp.QuoteMeta(query)).WillReturnRows(sqlmock.NewRows([]string{ diff --git a/src/query-performance-monitoring/performance-metrics/slow_query_metrics_test.go b/src/query-performance-monitoring/performance-metrics/slow_query_metrics_test.go index d44bbe17..efb57e93 100644 --- a/src/query-performance-monitoring/performance-metrics/slow_query_metrics_test.go +++ b/src/query-performance-monitoring/performance-metrics/slow_query_metrics_test.go @@ -16,7 +16,6 @@ import ( ) func TestPopulateSlowMetrics(t *testing.T) { - conn, mock := connection.CreateMockSQL(t) pgIntegration, _ := integration.New("test", "1.0.0") args := args.ArgumentList{QueryCountThreshold: 10} @@ -24,7 +23,6 @@ func TestPopulateSlowMetrics(t *testing.T) { version := uint64(13) validationQuery := fmt.Sprintf("SELECT count(*) FROM pg_extension WHERE extname = '%s'", "pg_stat_statements") mock.ExpectQuery(regexp.QuoteMeta(validationQuery)).WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1)) - expectedQuery := queries.SlowQueriesForV13AndAbove query := fmt.Sprintf(expectedQuery, "testdb", min(args.QueryCountThreshold, commonutils.MaxQueryThreshold)) mock.ExpectQuery(regexp.QuoteMeta(query)).WillReturnRows(sqlmock.NewRows([]string{ @@ -41,7 +39,6 @@ func TestPopulateSlowMetrics(t *testing.T) { } func TestPopulateSlowMetricsInEligibility(t *testing.T) { - conn, mock := connection.CreateMockSQL(t) pgIntegration, _ := integration.New("test", "1.0.0") args := args.ArgumentList{QueryCountThreshold: 10} @@ -49,7 +46,6 @@ func TestPopulateSlowMetricsInEligibility(t *testing.T) { version := uint64(13) validationQuery := fmt.Sprintf("SELECT count(*) FROM pg_extension WHERE extname = '%s'", "pg_stat_statements") mock.ExpectQuery(regexp.QuoteMeta(validationQuery)).WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(0)) - slowqueryList := performancemetrics.PopulateSlowRunningMetrics(conn, pgIntegration, args, databaseName, version) assert.Len(t, slowqueryList, 0)