Use the product token for the user agent in more locations (#7378)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -480,3 +481,11 @@ func TestParseTimestamp(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestProductToken(t *testing.T) {
|
||||
token := ProductToken()
|
||||
// Telegraf version depends on the call to SetVersion, it cannot be set
|
||||
// multiple times and is not thread-safe.
|
||||
re := regexp.MustCompile(`^Telegraf/[^\s]+ Go/\d+.\d+.\d+$`)
|
||||
require.True(t, re.MatchString(token), token)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user