buildkite / lifecycled

A daemon for responding to AWS AutoScaling Lifecycle Hooks
MIT License
146 stars 34 forks source link

Add test suite #52

Closed itsdalmo closed 6 years ago

itsdalmo commented 6 years ago

Based on the work in: https://github.com/buildkite/lifecycled/pull/50

I just decided to rewrite with inspiration from the PR above, to get a basic test suite up and running. In the process I figured it was prudent to do the following:

With the above in place, I wrote three basic tests to validate the behaviour of the daemon, with the goal of ignoring implementation details as far as possible. So for future PR's etc we should be able to run tests to catch things like Queues not being cleaned up.

Possible improvements:

Let me know what you think 👍

itsdalmo commented 6 years ago

Thoughts on this @lox?

lox commented 6 years ago

Apologies, I've been sick! 😷Will review this tomorrow!

itsdalmo commented 6 years ago

NP! Get well soon 🙌

lox commented 6 years ago

Can we go with /cmd/lifecycled/main.go so that go install ./cmd/lifecycled does the right thing?

itsdalmo commented 6 years ago

@lox - Thanks for the review! Have moved the binary, and feel confident that RFC3339 should work here - but we should test it in the wild before making a 3.0 release - are you up for that? 😄

edit: Just caught one error I had made; lifecycled.Config accepts a SpotListenerInterval, which was not being set in main.go and therefore defaulted to 0 and crashed the binary on startup. Fixed now, and everything works just dandy with autoscaling termination notices (need you to test spot terminations if possible) 👍

itsdalmo commented 6 years ago

What do you think @lox - is this ready to be merged?

lox commented 6 years ago

Yeah, let's merge it. Sorry for the delay.