You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/logtail
Denton Gentry 013da6660e logtail: add tests
+ add a test for parseAndRemoveLogLevel()
+ add a test for drainPendingMessages()
+ test JSON log encoding including several special cases

Other tests frequently send logs but a) don't check the result and
b) do so by happenstance, such that the code in encode() was not
consistently being exercised and leading to spurious changes in
code coverage. These tests attempt to more systematically test
the logging function.

This is the second attempt to add these tests, the first attempt
(in https://github.com/tailscale/tailscale/pull/1114) had two issues:
1. httptest.NewServer creates multiple goroutine handlers, and
   logtail uses goroutines to upload, but the first version had no
   locking in the server to guard this.
   Moved data handling into channels to get synchronization.
2. The channel to notify the test of the arrival of data had a depth
   of 1, in cases where the Logger sent multiple uploads it would
   block the server.

This resulted in the first iteration of these tests being flaky,
and we reverted it.

This new version of the tests has passed with
    go test -race -count=10000
and seems solid.

Signed-off-by: Denton Gentry <dgentry@tailscale.com>
4 years ago
..
backoff backoff: update to Go style, document a bit, make 30s explicit 4 years ago
example logtail, logpolicy: remove an unidiomatic use of an interface 4 years ago
filch all: adjust Unix permissions for those without umasks 4 years ago
.gitignore Move Linux client & common packages into a public repo. 5 years ago
README.md Move Linux client & common packages into a public repo. 5 years ago
api.md Move Linux client & common packages into a public repo. 5 years ago
buffer.go logtail: rename the unused CheckLogs to DrainLogs 5 years ago
id.go logtail: add PrivateID.IsZero method 5 years ago
id_test.go logtail: add ParsePublicID that doesn't allocate 5 years ago
logtail.go cmd/tailscaled, logpolicy, logtail: support log levels 4 years ago
logtail_test.go logtail: add tests 4 years ago

README.md

Tailscale Logs Service

This github repository contains libraries, documentation, and examples for working with the public API of the tailscale logs service.

For a very quick introduction to the core features, read the API docs and peruse the logs reprocessing example.

For more information, write to info@tailscale.io.