From 6a1442f1bc67df88e87c5d63698103834cc63b51 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Tue, 21 Dec 2021 13:44:10 -0700 Subject: [PATCH] fix: do not require networking during tests (#10321) --- plugins/inputs/snmp/snmp_test.go | 16 ++++++++++++++++ .../processors/reverse_dns/reversedns_test.go | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/plugins/inputs/snmp/snmp_test.go b/plugins/inputs/snmp/snmp_test.go index d018376b4..450f2ea7b 100644 --- a/plugins/inputs/snmp/snmp_test.go +++ b/plugins/inputs/snmp/snmp_test.go @@ -287,6 +287,10 @@ func TestSnmpInit_noName_noOid(t *testing.T) { } func TestGetSNMPConnection_v2(t *testing.T) { + if testing.Short() { + t.Skip("Skipping integration test in short mode") + } + s := &Snmp{ Agents: []string{"1.2.3.4:567", "1.2.3.4", "udp://127.0.0.1"}, ClientConfig: snmp.ClientConfig{ @@ -356,6 +360,10 @@ func stubTCPServer(wg *sync.WaitGroup) { } func TestGetSNMPConnection_v3(t *testing.T) { + if testing.Short() { + t.Skip("Skipping integration test in short mode") + } + s := &Snmp{ Agents: []string{"1.2.3.4"}, ClientConfig: snmp.ClientConfig{ @@ -396,6 +404,10 @@ func TestGetSNMPConnection_v3(t *testing.T) { } func TestGetSNMPConnection_v3_blumenthal(t *testing.T) { + if testing.Short() { + t.Skip("Skipping integration test in short mode") + } + testCases := []struct { Name string Algorithm gosnmp.SnmpV3PrivProtocol @@ -515,6 +527,10 @@ func TestGetSNMPConnection_v3_blumenthal(t *testing.T) { } func TestGetSNMPConnection_caching(t *testing.T) { + if testing.Short() { + t.Skip("Skipping integration test in short mode") + } + s := &Snmp{ Agents: []string{"1.2.3.4", "1.2.3.5", "1.2.3.5"}, } diff --git a/plugins/processors/reverse_dns/reversedns_test.go b/plugins/processors/reverse_dns/reversedns_test.go index 6db0b2ce5..060ca77a7 100644 --- a/plugins/processors/reverse_dns/reversedns_test.go +++ b/plugins/processors/reverse_dns/reversedns_test.go @@ -13,6 +13,10 @@ import ( ) func TestSimpleReverseLookup(t *testing.T) { + if testing.Short() { + t.Skip("Skipping integration test in short mode") + } + now := time.Now() m := metric.New("name", map[string]string{ "dest_ip": "8.8.8.8",