fix: do not require networking during tests (#10321)

This commit is contained in:
Joshua Powers 2021-12-21 13:44:10 -07:00 committed by GitHub
parent b59350b940
commit 6a1442f1bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 0 deletions

View File

@ -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"},
}

View File

@ -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",