-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Translate to tcp probe in queue-proxy when exec probe was used for readinessprobe in user-container #5712
Merged
Merged
Translate to tcp probe in queue-proxy when exec probe was used for readinessprobe in user-container #5712
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
012ffbb
Translate to tcp probe in queue-proxy when exec probe was used for re…
nak3 1296359
Add e2e test for exec readiness probe
nak3 8d4623f
Add tcp probe to conformance test
nak3 3b5f340
Fix review comment
nak3 f19ff68
Move test inline
nak3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,37 +31,65 @@ import ( | |
) | ||
|
||
func TestProbeRuntime(t *testing.T) { | ||
t.Parallel() | ||
cancel := logstream.Start(t) | ||
defer cancel() | ||
|
||
clients := test.Setup(t) | ||
|
||
names := test.ResourceNames{ | ||
Service: test.ObjectNameForTest(t), | ||
Image: "runtime", | ||
} | ||
var testCases = []struct { | ||
// name of the test case, which will be inserted in names of routes, configurations, etc. | ||
// Use a short name here to avoid hitting the 63-character limit in names | ||
// (e.g., "service-to-service-call-svc-cluster-local-uagkdshh-frkml-service" is too long.) | ||
name string | ||
// handler to be used for readiness probe in user container. | ||
handler corev1.Handler | ||
}{{ | ||
"httpGet", | ||
corev1.Handler{ | ||
HTTPGet: &corev1.HTTPGetAction{ | ||
Path: "/healthz", | ||
}, | ||
}, | ||
}, { | ||
"tcpSocket", | ||
corev1.Handler{ | ||
TCPSocket: &corev1.TCPSocketAction{}, | ||
}, | ||
}, { | ||
"exec", | ||
corev1.Handler{ | ||
Exec: &corev1.ExecAction{ | ||
Command: []string{"/ko-app/runtime", "probe"}, | ||
}, | ||
}, | ||
}} | ||
|
||
test.CleanupOnInterrupt(func() { test.TearDown(clients, names) }) | ||
defer test.TearDown(clients, names) | ||
for _, tc := range testCases { | ||
tc := tc | ||
t.Run(tc.name, func(t *testing.T) { | ||
t.Parallel() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will detach from the logstream, I'd move that in here as part of the change to |
||
names := test.ResourceNames{ | ||
Service: test.ObjectNameForTest(t), | ||
Image: test.Runtime, | ||
} | ||
|
||
t.Log("Creating a new Service") | ||
resources, _, err := v1a1test.CreateRunLatestServiceReady(t, clients, &names, | ||
false, /* https TODO(taragu) turn this on after helloworld test running with https */ | ||
v1a1opts.WithReadinessProbe( | ||
&corev1.Probe{ | ||
Handler: corev1.Handler{ | ||
HTTPGet: &corev1.HTTPGetAction{ | ||
Path: "/healthz", | ||
}, | ||
}, | ||
})) | ||
if err != nil { | ||
t.Fatalf("Failed to create initial Service: %v: %v", names.Service, err) | ||
} | ||
test.CleanupOnInterrupt(func() { test.TearDown(clients, names) }) | ||
defer test.TearDown(clients, names) | ||
|
||
// Check if scaling down works even if access from liveness probe exists. | ||
if err := e2e.WaitForScaleToZero(t, revisionresourcenames.Deployment(resources.Revision), clients); err != nil { | ||
t.Fatalf("Could not scale to zero: %v", err) | ||
t.Log("Creating a new Service") | ||
resources, _, err := v1a1test.CreateRunLatestServiceReady(t, clients, &names, | ||
false, /* https TODO(taragu) turn this on after helloworld test running with https */ | ||
v1a1opts.WithReadinessProbe( | ||
&corev1.Probe{ | ||
Handler: tc.handler, | ||
})) | ||
if err != nil { | ||
t.Fatalf("Failed to create initial Service: %v: %v", names.Service, err) | ||
nak3 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
// Check if scaling down works even if access from liveness probe exists. | ||
if err := e2e.WaitForScaleToZero(t, revisionresourcenames.Deployment(resources.Revision), clients); err != nil { | ||
t.Fatalf("Could not scale to zero: %v", err) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you add a case for TCP while you are in here?
I feel like for conformance we should have variants of these tests that FAIL the readiness probes. Could you either add that or open an issue to follow up?
cc @dgerd
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.
We've sort of been here before, but the runtime contract suggests that only
httpGet
andtcpSocket
probes should be used. We've quietly left exec probes in, but do we want to codify their allowance into our conformance tests?