Use the product token for the user agent in more locations (#7378)

This commit is contained in:
Daniel Nelson
2020-04-21 10:02:18 -07:00
committed by GitHub
parent c9a3b697b8
commit a4eb9c2205
7 changed files with 15 additions and 10 deletions

View File

@@ -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)
}