Skip to content

Commit

Permalink
Remove most t.Log() from tests (gravitational#28453)
Browse files Browse the repository at this point in the history
The t.Log() function calls have been removed from most tests. This is to keep our test logs cleaner and more focused on error messages. Logging every detail in tests makes it harder to spot actual errors and relevant information.
  • Loading branch information
jakule authored Jun 29, 2023
1 parent c33b604 commit 18a5327
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 12 deletions.
1 change: 0 additions & 1 deletion integrations/kube-agent-updater/pkg/img/cosign_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ func Test_cosignKeyValidator_ValidateAndResolveDigest(t *testing.T) {
// This is the worst case scenario and also reduces the amount of noise and failed calls in the logs.
testRegistry := httptest.NewServer(registry.New(registry.WithReferrersSupport(true)))
t.Cleanup(testRegistry.Close)
t.Log(testRegistry.URL)

// Put test layers and manifests into the registry
for digest, contents := range blobs {
Expand Down
2 changes: 0 additions & 2 deletions integrations/lib/testing/integration/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ func (s *IntegrationSSHSuite) TestSSH() {
require.NoError(t, err)

err = cmd.Wait()
t.Log("STDOUT", cmdStdout.String())
t.Log("STDERR", cmdStderr.String())
require.NoError(t, err)

require.Contains(t, cmdStdout.String(), fmt.Sprintf("MYUSER=%s", user.GetName()))
Expand Down
2 changes: 0 additions & 2 deletions lib/cloud/aws/tags_helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func TestTagsToLabels(t *testing.T) {
Value: aws.String("test"),
},
}
t.Log(inputTags)

expectLabels := map[string]string{
"Name": "test",
Expand All @@ -71,7 +70,6 @@ func TestTagsToLabels(t *testing.T) {
Value: aws.String("test"),
},
}
t.Log(inputTags)

expectLabels := map[string]string{
"Name": "test",
Expand Down
1 change: 0 additions & 1 deletion lib/kube/proxy/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ func TestCheckImpersonationPermissions(t *testing.T) {
}

for _, tt := range tests {
t.Log(tt.desc)
mock := &mockSARClient{
err: tt.sarErr,
allowedVerbs: tt.allowedVerbs,
Expand Down
3 changes: 0 additions & 3 deletions lib/kube/proxy/forwarder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -935,8 +935,6 @@ func TestSetupImpersonationHeaders(t *testing.T) {
},
}
for _, tt := range tests {
t.Log(tt.desc)

err := setupImpersonationHeaders(
logrus.NewEntry(logrus.New()),
authContext{
Expand All @@ -946,7 +944,6 @@ func TestSetupImpersonationHeaders(t *testing.T) {
},
tt.inHeaders,
)
t.Log("got error:", err)
tt.errAssertion(t, err)

if err == nil {
Expand Down
1 change: 0 additions & 1 deletion lib/srv/db/elasticsearch/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ func TestEngineGetQueryFromRequestBody(t *testing.T) {
e.Log = logrus.StandardLogger()

result := GetQueryFromRequestBody(e.EngineConfig, tt.contentType, []byte(tt.body))
t.Log(result)
require.Equal(t, tt.want, result)
})
}
Expand Down
1 change: 0 additions & 1 deletion lib/utils/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ func TestCompressAsTarGzArchive(t *testing.T) {

gotBytes, err := io.ReadAll(tarReader)
require.NoError(t, err)
t.Log(string(gotBytes))

require.Equal(t, tt.fsContents[header.Name].content, gotBytes)
require.Equal(t, tt.fsContents[header.Name].mode, fs.FileMode(header.Mode))
Expand Down
1 change: 0 additions & 1 deletion lib/web/join_tokens_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,6 @@ db_service:
}

if test.extraAssertions != nil {
t.Log(script)
test.extraAssertions(script)
}
})
Expand Down

0 comments on commit 18a5327

Please sign in to comment.