-
Notifications
You must be signed in to change notification settings - Fork 14
Description
Problem
The current validation logic starts up the functions framework servers, sleeps for a preconfigured time, and then attempts to send a request to the server.
- Server start:
shutdown, err := v.funcServer.Start() - Sleep (buildpack-based):
time.Sleep(time.Duration(*startDelay) * time.Second)
Sleep (local server):time.Sleep(time.Duration(*startDelay) * time.Second) - Request is sent:
if err := v.validate("http://localhost:8080"); err != nil {
The sleep time is configured by the client's startDelay flag and is configured per conformance test. If it's not configured long enough, it's possible that the server is not started up by the time the HTTP request is sent and the test fails or becomes flakey.
startDelay also forces a minimum wait time per test and might be adding unnecessary wait time.
Note that "server start" here is whatever command is passed to the conformance test client's --cmd flag and could be doing more work than just starting up the functions framework server, making it harder to choose the correct startDelay.
Suggestion
It would be better if the runValidation function checked for "health status" by seeing if there is something serving on localhost:8080 before sending the validating HTTP request instead of having each test guess the minimum required startDelay. That would eliminate the need to "guess" the correct start delay needed across different tests and repos.