Skip to content

Flakey tests - Validate healthy server startup before sending requests #72

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

Open
anniefu opened this issue May 11, 2021 · 0 comments
Open

Comments

@anniefu
Copy link
Contributor

anniefu commented May 11, 2021

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.

  1. Server start:
    shutdown, err := v.funcServer.Start()
  2. Sleep (buildpack-based):
    time.Sleep(time.Duration(*startDelay) * time.Second)

    Sleep (local server):
    time.Sleep(time.Duration(*startDelay) * time.Second)
  3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant