Skip to content

httpbin-demo: Add unit tests to fully exercise the status reporting #2059

@dwilding

Description

@dwilding

Our httpbin charm has a collect-status handler that accounts for various situations, but the unit tests don't cover all cases. The unit tests currently cover:

  • The charm going into active status under normal operation
  • The charm going into maintenance status if the container can't be reached - as a byproduct of trying to change the config in this situation

Other situations aren't covered. For example, the container is available but we haven't asked Pebble to create a service yet.

Some notes from discussion within Charm Tech:

Generally speaking, we should cover each case of the status reporting. We can consider the status reporting part of the charm's "user interface". It's fine to specifically test the status reporting. In some cases, this will be cleaner than always testing it as a byproduct of some other event. Best practice: Run update_status, don't run collect_unit_status.

I'm tracking this as an issue because it would be nice to link to the httpbin unit tests from the Ops docs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    26.04An item we hope to do in the 26.04 cycledocsImprovements or additions to documentationrainy daySmall items done in ~10% of each week's time

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions