Skip to content

feat: metadata service: make turnserver socket path configurable#840

Open
feld wants to merge 1 commit intomainfrom
turnserver-config
Open

feat: metadata service: make turnserver socket path configurable#840
feld wants to merge 1 commit intomainfrom
turnserver-config

Conversation

@feld
Copy link
Collaborator

@feld feld commented Feb 9, 2026

also add tests for the turnserver metadata

Fixes #779

@feld
Copy link
Collaborator Author

feld commented Feb 9, 2026

There were no real tests for the turnserver metadata stuff that I could see, so I included that, but I have no real experience with python test framework so that part was vibed but it looks like how I'd do things in other languages.

If someone with actual experience in Python tests could review it that would be great

@feld feld marked this pull request as ready for review February 9, 2026 19:03
@feld feld changed the title metadata service: make turnserver socket path configurable feat: metadata service: make turnserver socket path configurable Feb 17, 2026
also add tests for the turnserver metadata
@feld feld force-pushed the turnserver-config branch from 686edc4 to 0b21b83 Compare February 17, 2026 19:56
@feld feld had a problem deploying to staging2.testrun.org February 17, 2026 19:56 — with GitHub Actions Error
@feld feld temporarily deployed to staging-ipv4.testrun.org February 17, 2026 19:56 — with GitHub Actions Inactive

# Allow time for server to start
import time
time.sleep(0.01)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this doesn't look like a serious way to wait for a service to start, might cause flaky tests 🤔

Copy link
Contributor

@adbenitez adbenitez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, I didn't test but the change is simple and straightforward: just adding a new configuration option for a path instead of using a hard-coded value, can't say much about the tests tho better if someone with more deep understanding of the current tests machinery also take a look at it, the use of sleep give me a bad feeling, I didn't check if other tests also do this

Copy link
Contributor

@missytake missytake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly conflicted about this PR.

The additional config option looks innocent enough, it's a bit annoying to add new config options for small things which operators are only expected to edit with alternative deployment options, but fine with me if the chef cookbook needs this. I think my preference is saying "please rebase this on top of #853 so we don't have to put this option into the default-generated chatmail.ini, and can just set a default in config.py for everyone who doesn't need to think about this".

But then there is also the LLM-generated tests; you don't understand what they do, I don't understand what they do, they have some sketchy sleep statement in it... If they were in a separate PR, this one would be long approved.

Also, please fix the lint errors :) https://github.com/chatmail/relay/actions/runs/22113484762/job/63915452488?pr=840

Copy link
Contributor

@hpk42 hpk42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks. please simplify the PR along the review comments.

self.metadata = metadata
self.iroh_relay = iroh_relay
self.turn_hostname = turn_hostname
self.config = config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we avoid passing config around in favor of explicit values.
in this case it's the turn_socket_path that should be passed in.

@@ -0,0 +1,120 @@
"""Tests for turnserver functionality, particularly metadata integration."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think it's fine to just do offline config tests (that the config setting exists and has a proper default) and not try to test turn_credentials with mock servers etc. for now. it didn't have these tests before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are now tests for turnserver functionality here: 835b5e7#diff-fc3c6a3f43aaa8266eb10ce6dad7f018493f151fca34cecea33318d6ce719afa

Maybe we can take the turnserver tests out of this PR and use those instead?

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.

make turnserver server configurable

4 participants