-
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
Fix timeoutSeconds #15630
Fix timeoutSeconds #15630
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ import ( | |
|
||
// sendRequest send a request to "endpoint", returns error if unexpected response code, nil otherwise. | ||
func sendRequest(t *testing.T, clients *test.Clients, endpoint *url.URL, | ||
initialSleep, sleep time.Duration, expectedResponseCode int) error { | ||
initialSleep, sleep time.Duration, expectedResponseCode int, expectedBody string) error { | ||
client, err := pkgtest.NewSpoofingClient(context.Background(), clients.KubeClient, t.Logf, endpoint.Hostname(), test.ServingFlags.ResolvableDomain, test.AddRootCAtoTransport(context.Background(), t.Logf, clients, test.ServingFlags.HTTPS)) | ||
if err != nil { | ||
return fmt.Errorf("error creating Spoofing client: %w", err) | ||
|
@@ -68,7 +68,12 @@ func sendRequest(t *testing.T, clients *test.Clients, endpoint *url.URL, | |
if expectedResponseCode != resp.StatusCode { | ||
return fmt.Errorf("response status code = %v, want = %v, response = %v", resp.StatusCode, expectedResponseCode, resp) | ||
} | ||
|
||
if expectedBody != "" { | ||
gotBody := string(resp.Body) | ||
if expectedBody != gotBody { | ||
return fmt.Errorf("response body = %v, want = %v, response = %v", gotBody, expectedBody, resp) | ||
} | ||
} | ||
return nil | ||
} | ||
|
||
|
@@ -99,6 +104,7 @@ func TestRevisionTimeout(t *testing.T) { | |
expectedStatus: http.StatusOK, | ||
sleep: 15 * time.Second, | ||
initialSleep: 0, | ||
expectedBody: "activator request timeout", | ||
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. We should delete the test like @izabelacg recommended since it was originally intended to test idle timeout and we have that in our e2e test We now know why this test was passing when it shouldn't have. 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. Once you write a 200 back you cant fail it. I dont think we should avoid testing this. 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. conformance tests can't assume things about the implementation. This scenario isn't defined in the knative spec so I'd rather remove it from these tests. I believe we have the coverage in our e2e tests 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. @dprotaso As we discussed it is not in the spec but imho it should be defined as it is something the user sees from our implementation (user gets a body txt that is part of the system behavior). Who should we ask about Cloud run? Maybe we could add this to the spec. |
||
}} | ||
|
||
for _, tc := range testCases { | ||
|
@@ -136,7 +142,7 @@ func TestRevisionTimeout(t *testing.T) { | |
t.Fatalf("Error probing %s: %v", serviceURL, err) | ||
} | ||
|
||
if err := sendRequest(t, clients, serviceURL, tc.initialSleep, tc.sleep, tc.expectedStatus); err != nil { | ||
if err := sendRequest(t, clients, serviceURL, tc.initialSleep, tc.sleep, tc.expectedStatus, tc.expectedBody); err != nil { | ||
t.Errorf("Failed request with initialSleep %v, sleep %v, with revision timeout %ds, expecting status %v: %v", | ||
tc.initialSleep, tc.sleep, tc.timeoutSeconds, tc.expectedStatus, err) | ||
} | ||
|
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.
why drop tryResponseStartTimeoutAndWriteError ?