Skip to content

Commit

Permalink
resolved : lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tharun0064 committed Jan 15, 2025
1 parent befb1ed commit 8b1fe92
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ package performancemetrics_test

import (
"fmt"
"regexp"
"testing"

commonutils "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/common-utils"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/queries"
"gopkg.in/DATA-DOG/go-sqlmock.v1"
"regexp"
"testing"

"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/nri-postgresql/src/args"
"github.com/newrelic/nri-postgresql/src/connection"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/performance-metrics"
performancemetrics "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/performance-metrics"
"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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/datamodels"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/performance-metrics"
performancemetrics "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/performance-metrics"
"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/newrelic/infra-integrations-sdk/v3/integration"
"github.com/newrelic/nri-postgresql/src/args"
"github.com/newrelic/nri-postgresql/src/connection"
"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/newrelic/nri-postgresql/src/query-performance-monitoring/datamodels"
"github.com/newrelic/nri-postgresql/src/query-performance-monitoring/performance-metrics"
performancemetrics "github.com/newrelic/nri-postgresql/src/query-performance-monitoring/performance-metrics"
"github.com/stretchr/testify/assert"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,11 @@ func TestGetSlowRunningEmptyMetrics(t *testing.T) {
}

func TestGetSlowRunningMetricsUnsupportedVersion(t *testing.T) {

conn, mock := connection.CreateMockSQL(t)
args := args.ArgumentList{QueryCountThreshold: 10}
databaseName := "testdb"
version := uint64(11)

slowQueryList, _, err := performancemetrics.GetSlowRunningMetrics(conn, args, databaseName, version)

assert.EqualError(t, err, commonutils.ErrUnsupportedVersion.Error())
assert.Len(t, slowQueryList, 0)
assert.NoError(t, mock.ExpectationsWereMet())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
)

func TestPopulateWaitEventMetrics(t *testing.T) {

conn, mock := connection.CreateMockSQL(t)
pgIntegration, _ := integration.New("test", "1.0.0")
args := args.ArgumentList{QueryCountThreshold: 10}
Expand All @@ -26,7 +25,6 @@ func TestPopulateWaitEventMetrics(t *testing.T) {
mock.ExpectQuery(regexp.QuoteMeta(validationQuery)).WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1))
validationQueryStatStatements := fmt.Sprintf("SELECT count(*) FROM pg_extension WHERE extname = '%s'", "pg_stat_statements")
mock.ExpectQuery(regexp.QuoteMeta(validationQueryStatStatements)).WillReturnRows(sqlmock.NewRows([]string{"count"}).AddRow(1))

var query = fmt.Sprintf(queries.WaitEvents, databaseName, min(args.QueryCountThreshold, commonutils.MaxQueryThreshold))
mock.ExpectQuery(regexp.QuoteMeta(query)).WillReturnRows(sqlmock.NewRows([]string{
"wait_event_name", "wait_category", "total_wait_time_ms", "collection_timestamp", "query_id", "query_text", "database_name",
Expand All @@ -40,7 +38,6 @@ func TestPopulateWaitEventMetrics(t *testing.T) {
}

func TestPopulateWaitEventMetricsInEligibility(t *testing.T) {

conn, mock := connection.CreateMockSQL(t)
pgIntegration, _ := integration.New("test", "1.0.0")
args := args.ArgumentList{QueryCountThreshold: 10}
Expand Down

0 comments on commit 8b1fe92

Please sign in to comment.