Skip to content

Conversation

@86667
Copy link
Contributor

@86667 86667 commented Nov 29, 2025

Here we implement a builder for EphemeralTestnet for the purpose of allowing a homeserver config to be specified.
This patterns allows for further customisation possibilities, too.

Right now with this we:

  • Enable Metrics server only where necessary
  • Enable Admin server only where necessary

@86667 86667 force-pushed the testnet_customisable branch from 109f1a6 to ee01a45 Compare November 29, 2025 12:37
@86667 86667 requested review from SHAcollision and SeverinAlexB and removed request for SHAcollision November 29, 2025 12:38
@86667 86667 force-pushed the testnet_customisable branch from 82ab0b4 to 31d664e Compare December 1, 2025 09:33
Copy link
Contributor

@SHAcollision SHAcollision left a comment

Choose a reason for hiding this comment

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

Nice work! I think the only way to know how if this is good to go or more changes are needed is to jump into pubky/pubky-nexus repo, swap pubky-tesnet and pubky deps for the ones on this branch and see how difficult/easy the transition is. I think the transition might not be possible "as is". But it might be worth pinging @ok300 for further review/comments.

let testnet = EphemeralTestnet::start().await.unwrap();
use pubky_testnet::pubky_homeserver::ConfigToml;
let mut config = ConfigToml::default_test_config();
config.admin.enabled = true; // Enable admin server
Copy link
Contributor

Choose a reason for hiding this comment

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

The EphemeralTestnet promises an admin server, but builder().build() now always uses ConfigToml::test() (whose default_test_config disables admin and metrics) before starting the homeserver. As a result, EphemeralTestnet::start() returns a network without an admin server unless callers explicitly override the config, which can break existing consumers relying on the prior default.


me.testnet.create_http_relay().await?;
me.testnet.create_homeserver().await?;
impl EphemeralTestnetBuilder {
Copy link
Contributor

Choose a reason for hiding this comment

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

The previous start_with_custom_postgres and start_minimal_with_custom_postgres entry points are gone, and the new builder always provisions a homeserver. There is no way to create a minimal network (HTTP relay only) while pointing at a custom Postgres URL, and the start_minimal shortcut cannot take a connection string anymore. This is likely a public API regression for downstream tests/tools that depended on those entry points (e.g. Nexus tests)


/// Create an additional homeserver with a random keypair
/// Create an additional homeserver with a random keypair.
pub async fn create_random_homeserver(
Copy link
Contributor

@SHAcollision SHAcollision Dec 1, 2025

Choose a reason for hiding this comment

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

Homeserver creation helpers disable admin/metrics by default. This changes behaviour for callers that previously might be expecting the extra homeservers to expose admin endpoints out of the box; if that change is intentional it should be documented and the helper name/comment updated, otherwise the defaults should be restored or gated by parameters. I can't recall if the homeserver admin server is ever used or not in any of the Nexus test cases. Maybe it is on the pubky-moderation tests?

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.

3 participants