aws / amazon-ssm-agent

An agent to enable remote management of your EC2 instances, on-premises servers, or virtual machines (VMs).
https://aws.amazon.com/systems-manager/
Apache License 2.0
1.03k stars 323 forks source link

Production code depends on testify mocks #475

Closed chrisnovakovic closed 1 year ago

chrisnovakovic commented 1 year ago

There are several instances in the codebase where a logger is required in order to make a function call, but messages sent to the logger by the function don't need to be exposed to the user. In these cases, agent/log's NewSilentMockLog function, which returns a mock implementation of log.T, is used:

https://github.com/aws/amazon-ssm-agent/blob/db56c99f4966ce1e60290b613b87326db080cb85/agent/log/test_log.go#L51-L56

Unfortunately this introduces a dependency on github.com/stretchr/testify/mock into the production binaries, which isn't ideal. IMO, it would be better to create a new seelog logger, similar to DefaultLogger, that simply discards anything that is sent to it by setting its minimum log level to off.

sluggard76 commented 1 year ago

We are working to remove mocks from production code. Once complete, we'll publish a new version.