Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Run only staticcheck for now. Additional linters will be enabled one-by-one.
linters:
enable:
- staticcheck
disable-all: true
enable:
- misspell
- staticcheck
4 changes: 2 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ func (s *HeaderMatch) UnmarshalYAML(unmarshal func(interface{}) error) error {
//
// With that logic, this function validates that if a compression
// algorithm is specified, it's covered by the specified accept encoding
// header. It doesn't need to be the most prefered encoding, but it MUST
// be included in the prefered encodings.
// header. It doesn't need to be the most preferred encoding, but it MUST
// be included in the preferred encodings.
func isCompressionAcceptEncodingValid(encoding, acceptEncoding string) bool {
// unspecified compression + any encoding value is valid
// any compression + no accept encoding is valid
Expand Down
26 changes: 13 additions & 13 deletions prober/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func TestContentLength(t *testing.T) {
fw.Close()
return testdata{
msg: msg,
contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer.
contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(buf.Bytes()), // No decompression.
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "br")
Expand All @@ -194,7 +194,7 @@ func TestContentLength(t *testing.T) {
fw.Close()
return testdata{
msg: msg,
contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer.
contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(buf.Bytes()), // No decompression.
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "deflate")
Expand All @@ -213,7 +213,7 @@ func TestContentLength(t *testing.T) {
gw.Close()
return testdata{
msg: msg,
contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer.
contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(buf.Bytes()), // No decompression.
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "gzip")
Expand Down Expand Up @@ -285,7 +285,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) {
enc.Write(msg)
enc.Close()
return testdata{
contentLength: buf.Len(), // Content lenght is the length of the compressed buffer.
contentLength: buf.Len(), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(msg),
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "gzip")
Expand All @@ -306,7 +306,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) {
enc.Write(msg)
enc.Close()
return testdata{
contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer.
contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(msg),
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "br")
Expand All @@ -328,7 +328,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) {
enc.Write(msg)
enc.Close()
return testdata{
contentLength: len(buf.Bytes()), // Content lenght is the length of the compressed buffer.
contentLength: len(buf.Bytes()), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(msg),
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "deflate")
Expand Down Expand Up @@ -367,7 +367,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) {
enc.Close()
return testdata{
expectFailure: true,
contentLength: buf.Len(), // Content lenght is the length of the compressed buffer.
contentLength: buf.Len(), // Content length is the length of the compressed buffer.
uncompressedBodyLength: 0,
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "gzip")
Expand All @@ -389,7 +389,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) {
enc.Close()
return testdata{
expectFailure: false,
contentLength: buf.Len(), // Content lenght is the length of the compressed buffer.
contentLength: buf.Len(), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(msg),
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "gzip")
Expand All @@ -414,7 +414,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) {
enc.Close()
return testdata{
expectFailure: false,
contentLength: buf.Len(), // Content lenght is the length of the compressed buffer.
contentLength: buf.Len(), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(msg),
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "gzip")
Expand All @@ -439,7 +439,7 @@ func TestHandlingOfCompressionSetting(t *testing.T) {
enc.Close()
return testdata{
expectFailure: false,
contentLength: buf.Len(), // Content lenght is the length of the compressed buffer.
contentLength: buf.Len(), // Content length is the length of the compressed buffer.
uncompressedBodyLength: len(msg),
handler: func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Encoding", "gzip")
Expand Down Expand Up @@ -728,7 +728,7 @@ func TestRedirectionLimit(t *testing.T) {
registry,
log.NewNopLogger())
if result {
t.Fatalf("Probe suceeded unexpectedly")
t.Fatalf("Probe succeeded unexpectedly")
}

if tooManyRedirects {
Expand Down Expand Up @@ -825,7 +825,7 @@ func TestFailIfNotSSL(t *testing.T) {
config.Module{Timeout: time.Second, HTTP: config.HTTPProbe{IPProtocolFallback: true, FailIfNotSSL: true}}, registry, log.NewNopLogger())
body := recorder.Body.String()
if result {
t.Fatalf("Fail if not SSL test suceeded unexpectedly, got %s", body)
t.Fatalf("Fail if not SSL test succeeded unexpectedly, got %s", body)
}
mfs, err := registry.Gather()
if err != nil {
Expand Down Expand Up @@ -1204,7 +1204,7 @@ func TestFailIfSelfSignedCA(t *testing.T) {
}}, registry, log.NewNopLogger())
body := recorder.Body.String()
if result {
t.Fatalf("Fail if selfsigned CA test suceeded unexpectedly, got %s", body)
t.Fatalf("Fail if selfsigned CA test succeeded unexpectedly, got %s", body)
}
mfs, err := registry.Gather()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion prober/tcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestTCPConnectionFails(t *testing.T) {
testCTX, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if ProbeTCP(testCTX, ":0", config.Module{TCP: config.TCPProbe{}}, registry, log.NewNopLogger()) {
t.Fatalf("TCP module suceeded, expected failure.")
t.Fatalf("TCP module succeeded, expected failure.")
}
}

Expand Down