-
Notifications
You must be signed in to change notification settings - Fork 51
modified the way to terminate disable script with commandContext #1112
modified the way to terminate disable script with commandContext #1112
Conversation
2d34e88
to
1d07449
Compare
pkg/hoist/hoist_launchable_test.go
Outdated
@@ -14,6 +15,8 @@ import ( | |||
. "github.com/anthonybishopric/gotcha" | |||
) | |||
|
|||
var terminationGracePeriod = 1 * time.Hour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still not thrilled with us defaulting to 1 hour, but I think I lost that battle before I joined 😢
@@ -428,7 +431,7 @@ func TestDisableWithFailingDisable(t *testing.T) { | |||
func TestDisableWithPassingDisable(t *testing.T) { | |||
// This test's behavior is not dependent on whether the pod is a legacy or uuid pod | |||
hl, _ := FakeHoistLaunchableForDirLegacyPod("successful_scripts_test_hoist_launchable") | |||
err := hl.Disable() | |||
err := hl.Disable(terminationGracePeriod) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any tests that are exercising the new termination grace period (and I suggest you use a lower value than 1 hour when you test it 😉 ).
1d07449
to
62200b9
Compare
62200b9
to
ed91471
Compare
ed91471
to
e2ef222
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine with a nit, curious what @esuen thinks to make sure I didn't miss something though.
@@ -1,2 +1,4 @@ | |||
#!/bin/bash | |||
echo "sleeping for 2 second to test termination grace period" | |||
sleep 0.005 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The echo and sleep statements don't line up. I'm good with the test being so fast that the sleep
can be super short, but can we make the echo
match the reality?
8a96fec
to
c5cf45c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
For hosit launchable, terminate the disable script when grace period is met;
for docker launchable, we do not need to terminate the disable process, just unblock the p2-preparer waiting for the disable script, and proceed killing the container.
Also not only for disable script, this commit enables p2 to have termination grace period on any step.