Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: mark integration tests correctly #11317

Merged
merged 1 commit into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/influxdata/telegraf/testutil"
)

func TestReadsMetricsFromKafka(t *testing.T) {
func TestReadsMetricsFromKafkaIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/inputs/leofs/leofs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,31 +159,31 @@ func testMain(t *testing.T, code string, endpoint string, serverType ServerType)
}
}

func TestLeoFSManagerMasterMetrics(t *testing.T) {
func TestLeoFSManagerMasterMetricsIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}

testMain(t, fakeSNMP4Manager, "localhost:4020", ServerTypeManagerMaster)
}

func TestLeoFSManagerSlaveMetrics(t *testing.T) {
func TestLeoFSManagerSlaveMetricsIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}

testMain(t, fakeSNMP4Manager, "localhost:4021", ServerTypeManagerSlave)
}

func TestLeoFSStorageMetrics(t *testing.T) {
func TestLeoFSStorageMetricsIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}

testMain(t, fakeSNMP4Storage, "localhost:4010", ServerTypeStorage)
}

func TestLeoFSGatewayMetrics(t *testing.T) {
func TestLeoFSGatewayMetricsIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down
20 changes: 10 additions & 10 deletions plugins/inputs/sqlserver/azuresqldbqueries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"
)

func TestAzureSQL_Database_ResourceStats_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_ResourceStats_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -53,7 +53,7 @@ func TestAzureSQL_Database_ResourceStats_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_ResourceGovernance_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_ResourceGovernance_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestAzureSQL_Database_ResourceGovernance_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_WaitStats_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_WaitStats_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -151,7 +151,7 @@ func TestAzureSQL_Database_WaitStats_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_DatabaseIO_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_DatabaseIO_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -197,7 +197,7 @@ func TestAzureSQL_Database_DatabaseIO_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_ServerProperties_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_ServerProperties_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -238,7 +238,7 @@ func TestAzureSQL_Database_ServerProperties_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_OsWaitstats_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_OsWaitstats_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -276,7 +276,7 @@ func TestAzureSQL_Database_OsWaitstats_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_MemoryClerks_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_MemoryClerks_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -309,7 +309,7 @@ func TestAzureSQL_Database_MemoryClerks_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_PerformanceCounters_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_PerformanceCounters_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -345,7 +345,7 @@ func TestAzureSQL_Database_PerformanceCounters_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_Requests_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_Requests_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -403,7 +403,7 @@ func TestAzureSQL_Database_Requests_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Database_Schedulers_Query(t *testing.T) {
func TestAzureSQLIntegration_Database_Schedulers_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down
23 changes: 12 additions & 11 deletions plugins/inputs/sqlserver/azuresqlmanagedqueries_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package sqlserver

import (
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/require"
"os"
"testing"

"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/require"
)

func TestAzureSQL_Managed_ResourceStats_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_ResourceStats_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -40,7 +41,7 @@ func TestAzureSQL_Managed_ResourceStats_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Managed_ResourceGovernance_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_ResourceGovernance_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -81,7 +82,7 @@ func TestAzureSQL_Managed_ResourceGovernance_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Managed_DatabaseIO_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_DatabaseIO_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -122,7 +123,7 @@ func TestAzureSQL_Managed_DatabaseIO_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Managed_ServerProperties_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_ServerProperties_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -169,7 +170,7 @@ func TestAzureSQL_Managed_ServerProperties_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Managed_OsWaitStats_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_OsWaitStats_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -206,7 +207,7 @@ func TestAzureSQL_Managed_OsWaitStats_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Managed_MemoryClerks_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_MemoryClerks_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -238,7 +239,7 @@ func TestAzureSQL_Managed_MemoryClerks_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Managed_PerformanceCounters_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_PerformanceCounters_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -273,7 +274,7 @@ func TestAzureSQL_Managed_PerformanceCounters_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Managed_Requests_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_Requests_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -331,7 +332,7 @@ func TestAzureSQL_Managed_Requests_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_Managed_Schedulers_Query(t *testing.T) {
func TestAzureSQLIntegration_Managed_Schedulers_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down
19 changes: 10 additions & 9 deletions plugins/inputs/sqlserver/azuresqlpoolqueries_test.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package sqlserver

import (
"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/require"
"os"
"testing"

"github.com/influxdata/telegraf/testutil"
"github.com/stretchr/testify/require"
)

func TestAzureSQL_ElasticPool_ResourceStats_Query(t *testing.T) {
func TestAzureSQLIntegration_ElasticPool_ResourceStats_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -49,7 +50,7 @@ func TestAzureSQL_ElasticPool_ResourceStats_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_ElasticPool_ResourceGovernance_Query(t *testing.T) {
func TestAzureSQLIntegration_ElasticPool_ResourceGovernance_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -112,7 +113,7 @@ func TestAzureSQL_ElasticPool_ResourceGovernance_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_ElasticPool_DatabaseIO_Query(t *testing.T) {
func TestAzureSQLIntegration_ElasticPool_DatabaseIO_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -156,7 +157,7 @@ func TestAzureSQL_ElasticPool_DatabaseIO_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_ElasticPool_OsWaitStats_Query(t *testing.T) {
func TestAzureSQLIntegration_ElasticPool_OsWaitStats_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -193,7 +194,7 @@ func TestAzureSQL_ElasticPool_OsWaitStats_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_ElasticPool_MemoryClerks_Query(t *testing.T) {
func TestAzureSQLIntegration_ElasticPool_MemoryClerks_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -225,7 +226,7 @@ func TestAzureSQL_ElasticPool_MemoryClerks_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_ElasticPool_PerformanceCounters_Query(t *testing.T) {
func TestAzureSQLIntegration_ElasticPool_PerformanceCounters_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -259,7 +260,7 @@ func TestAzureSQL_ElasticPool_PerformanceCounters_Query(t *testing.T) {
server.Stop()
}

func TestAzureSQL_ElasticPool_Schedulers_Query(t *testing.T) {
func TestAzureSQLIntegration_ElasticPool_Schedulers_Query(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down
35 changes: 23 additions & 12 deletions plugins/inputs/sqlserver/sqlserver_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package sqlserver

import (
"os"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -108,7 +109,7 @@ func TestSqlServer_ParseMetrics(t *testing.T) {
}
}

func TestSqlServer_MultipleInstanceIntegration(t *testing.T) {
func TestSqlServerIntegration_MultipleInstance(t *testing.T) {
// Invoke Gather() from two separate configurations and
// confirm they don't interfere with each other
t.Skip("Skipping as unable to open tcp connection with host '127.0.0.1:1433")
Expand Down Expand Up @@ -143,7 +144,7 @@ func TestSqlServer_MultipleInstanceIntegration(t *testing.T) {
require.False(t, acc2.HasMeasurement("Log size (bytes)"))
}

func TestSqlServer_MultipleInstanceWithHealthMetricIntegration(t *testing.T) {
func TestSqlServerIntegration_MultipleInstanceWithHealthMetric(t *testing.T) {
// Invoke Gather() from two separate configurations and
// confirm they don't interfere with each other.
// This test is intentionally similar to TestSqlServer_MultipleInstanceIntegration.
Expand Down Expand Up @@ -329,15 +330,18 @@ func TestSqlServer_ConnectionString(t *testing.T) {
require.Equal(t, emptyDatabaseName, database)
}

func TestSqlServer_AGQueriesApplicableForDatabaseTypeSQLServer(t *testing.T) {
func TestSqlServerIntegration_AGQueriesApplicableForDatabaseTypeSQLServer(t *testing.T) {
// This test case checks where Availability Group (AG / HADR) queries return an output when included for processing for DatabaseType = SQLServer
// And they should not be processed when DatabaseType = AzureSQLDB

// Please change the connection string to connect to relevant database when executing the test case

t.Skip("Skipping as unable to open tcp connection with host '127.0.0.1:1433")
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}

testServer := "Server=127.0.0.1;Port=1433;Database=testdb1;User Id=SA;Password=ABCabc01;app name=telegraf;log=1"
if os.Getenv("AZURESQL_POOL_CONNECTION_STRING") == "" {
t.Skip("Missing environment variable AZURESQL_POOL_CONNECTION_STRING")
}
testServer := os.Getenv("AZURESQL_POOL_CONNECTION_STRING")

s := &SQLServer{
Servers: []string{testServer},
Expand Down Expand Up @@ -372,15 +376,22 @@ func TestSqlServer_AGQueriesApplicableForDatabaseTypeSQLServer(t *testing.T) {
s2.Stop()
}

func TestSqlServer_AGQueryFieldsOutputBasedOnSQLServerVersion(t *testing.T) {
func TestSqlServerIntegration_AGQueryFieldsOutputBasedOnSQLServerVersion(t *testing.T) {
// This test case checks where Availability Group (AG / HADR) queries return specific fields supported by corresponding SQL Server version database being connected to.

// Please change the connection strings to connect to relevant database when executing the test case
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}

t.Skip("Skipping as unable to open tcp connection with host '127.0.0.1:1433")
if os.Getenv("AZURESQL_POOL_CONNECTION_STRING_2019") == "" {
t.Skip("Missing environment variable AZURESQL_POOL_CONNECTION_STRING_2019")
}
if os.Getenv("AZURESQL_POOL_CONNECTION_STRING_2012") == "" {
t.Skip("Missing environment variable AZURESQL_POOL_CONNECTION_STRING_2012")
}

testServer2019 := "Server=127.0.0.10;Port=1433;Database=testdb2019;User Id=SA;Password=ABCabc01;app name=telegraf;log=1"
testServer2012 := "Server=127.0.0.20;Port=1433;Database=testdb2012;User Id=SA;Password=ABCabc01;app name=telegraf;log=1"
testServer2019 := os.Getenv("AZURESQL_POOL_CONNECTION_STRING_2019")
testServer2012 := os.Getenv("AZURESQL_POOL_CONNECTION_STRING_2012")

s2019 := &SQLServer{
Servers: []string{testServer2019},
Expand Down
4 changes: 2 additions & 2 deletions plugins/inputs/x509_cert/x509_cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func TestGatherChain(t *testing.T) {
}
}

func TestGatherUDPCert(t *testing.T) {
func TestGatherUDPCertIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down Expand Up @@ -336,7 +336,7 @@ func TestGatherCertIntegration(t *testing.T) {
require.True(t, acc.HasMeasurement("x509_cert"))
}

func TestGatherCertMustNotTimeout(t *testing.T) {
func TestGatherCertMustNotTimeoutIntegration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
Expand Down
Loading