Skip to content

feat(core): Add --testing flag to cocod#281

Merged
ketiltrout merged 1 commit into
chime-upgradefrom
testing_flag
Jun 6, 2026
Merged

feat(core): Add --testing flag to cocod#281
ketiltrout merged 1 commit into
chime-upgradefrom
testing_flag

Conversation

@ketiltrout

Copy link
Copy Markdown
Member

This is another bit of convenience for the reworked coco_runner test fixture.

This adds an optional flag, --testing, to the cocod command-line which will be used by the coco_runner to put cocod into a test-isolation mode. When this flag is used:

  • cocod doesn't read any config from the standard config paths, but only from paths given by the COCO_CONFIG_FILE envar or on the command line.
  • cocod ignores a port specified in the config, and instead binds to a random port on localhost only.
  • So the runner knows which port it's listening on, cocod writes the port to a temporary state file called "_TESTING", which the runner can read the port from.
  • Cocod also inserts the random port it was assigned back into its own config so that a client fetching the config will get the correct port.

The goal here is to ensure that, even were the cocod tests to be run on a host that happens to be running cocod in production, the test runner won't be able to interfere with or be affected by the production system.

This is another bit of convenience for the reworked coco_runner test
fixture.

This adds an optional flag, `--testing`, to the cocod command-line which
will be used by the coco_runner to put cocod into a test-isolation mode.
When this flag is used:

* cocod doesn't read any config from the standard config paths, but only
  from paths given by the COCO_CONFIG_FILE envar or on the command line.
* cocod ignores a port specified in the config, and instead binds to
  a random port _on localhost only_.
* So the runner knows which port it's listening on, cocod writes the
  port to a temporary state file called "_TESTING", which the runner can
  read the port from.
* Cocod also inserts the random port it was assigned back into its own
  config so that a client fetching the config will get the correct
  port.

The goal here is to ensure that, even were the cocod tests to be
run on a host that happens to be running cocod in production, the
test runner won't be able to interfere with or be affected by the
production system.
@ketiltrout ketiltrout merged commit be2c1ff into chime-upgrade Jun 6, 2026
5 checks passed
@ketiltrout ketiltrout deleted the testing_flag branch June 6, 2026 01:17
ketiltrout added a commit that referenced this pull request Jun 10, 2026
Otherwise the `self.config` that the worker receives doesn't have the updated port number. Follow-up to #281
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

Successfully merging this pull request may close these issues.

2 participants