Skip to content

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

@anniefu

Description

@anniefu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions