This PR based off https://github.com/buildkite/lifecycled/pull/45, hence it contains all the commits from that one. Started off writing some basic tests that at least cover cases like cleaning up queues after the listener exits etc. When testing we need to use logrus.NewNullLogger(), so I had to rewrite some code to avoid using the default/global logger in logrus - ended up with the following pattern:
Daemon includes a logrus.Logger.
Listener's accept a logrus.Entry which is used for log entries. This allows us to set fields and have them included in all log entries (e.g. the instance id and/or listener type).
All the references to itsdalmo/lifecycled (after this PR and #45 is merged, I'll stop using my fork to make PR's)
time.NewTicker only triggers after the first duration has passed, which means that a few of spot listener tests take 5 seconds to complete.
I'm wondering if perhaps the create/delete queue log entries should be info instead of debug since it only happens once in the lifetime of the program and gives you greater confidence that it has started correctly etc.
This PR based off https://github.com/buildkite/lifecycled/pull/45, hence it contains all the commits from that one. Started off writing some basic tests that at least cover cases like cleaning up queues after the listener exits etc. When testing we need to use
logrus.NewNullLogger()
, so I had to rewrite some code to avoid using the default/global logger in logrus - ended up with the following pattern:Daemon
includes alogrus.Logger
.Listener
's accept alogrus.Entry
which is used for log entries. This allows us to set fields and have them included in all log entries (e.g. the instance id and/or listener type).Example of the log entries below:
Stuff that needs fixing:
itsdalmo/lifecycled
(after this PR and #45 is merged, I'll stop using my fork to make PR's)time.NewTicker
only triggers after the first duration has passed, which means that a few of spot listener tests take 5 seconds to complete.info
instead ofdebug
since it only happens once in the lifetime of the program and gives you greater confidence that it has started correctly etc.