Skip to content

Commit

Permalink
fix timeout issue #8809
Browse files Browse the repository at this point in the history
  • Loading branch information
彭浩 committed Feb 6, 2021
1 parent 18973ce commit ac4cda1
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
1 change: 0 additions & 1 deletion plugins/inputs/x509_cert/x509_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,6 @@ func init() {
inputs.Add("x509_cert", func() telegraf.Input {
return &X509Cert{
Sources: []string{},
Timeout: internal.Duration{Duration: 5},
}
})
}
18 changes: 0 additions & 18 deletions plugins/inputs/x509_cert/x509_cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package x509_cert
import (
"crypto/tls"
"encoding/base64"
"errors"
"fmt"
"io/ioutil"
"math/big"
Expand Down Expand Up @@ -367,23 +366,6 @@ func TestGatherCertMustNotTimeout(t *testing.T) {
assert.True(t, acc.HasMeasurement("x509_cert"))
}

func TestGatherCertMustTimeoutWithNoDuration(t *testing.T) {
if testing.Short() {
t.Skip("Skipping integration test in short mode")
}
m := &X509Cert{
Sources: []string{"https://www.influxdata.com:443"},
Timeout: internal.Duration{Duration: 5}, // duration is set to 5 when adding to inputs
}
m.Init()

var acc testutil.Accumulator
err := m.Gather(&acc)
require.NoError(t, err)
require.Contains(t, acc.Errors, errors.New("cannot get SSL cert 'https://www.influxdata.com:443': dial tcp: i/o timeout"))
assert.False(t, acc.HasMeasurement("x509_cert"))
}

func TestServerName(t *testing.T) {
tests := []struct {
name string
Expand Down

0 comments on commit ac4cda1

Please sign in to comment.