[v3] feat: accept a password for a named bot in createPlayer - #66
Merged
Conversation
A bot named by the test bypasses the account pool, so nothing knew a
password for it and an auth plugin had no way to log it in. The only
workaround was authme's plugin-wide `password` option, which is a plain
value and documented as local-throwaway only.
createPlayer({ username, password }) threads the password through to the
synthetic account. No registration state needed: onPlayerCreate already
ignores account.justCreated and answers whichever prompt arrives, so a
name the server knows logs in and a fresh one registers.
A password without a username, where the environment has a pool, throws
rather than being silently dropped.
…the stand Neither test needs the name FriendBot; both just need a second player. createPlayer() with no username leases from the pool, so on the stand they get a real account instead of bypassing it, and they come off excludeTests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes the direction we settled on in #58: no account store, just the one gap that was real.
createPlayer({ password })A bot the test names bypasses the pool (
test-runner.ts,const pool = options?.username ? null : ...), andsyntheticAccount()never set a password, so an auth plugin had nothing to log it in with. The only way out wasauth-authme's plugin-widepasswordoption, which is a plain value and its own doc limits to a throwaway local server.The password now threads
createPlayer→connect→syntheticAccount. Nothing else was needed:onPlayerCreatealready ignoresaccount.justCreatedand answers whichever prompt actually arrives, so a name the server knows gets/loginand a fresh one gets/register.A password with no username, in an environment that has a pool, throws — a pooled account carries its own, so the passed one would have gone nowhere.
multi-botandCross-botoffexcludeTestsThis is the correction from the issue thread. Neither test needs the name
FriendBot; they need a second bot.createPlayer()with no username already leases one from the pool, so dropping the name is the whole fix and both tests now run on the stand.Docs
createPlayer()in the API reference gets its options, and the "an explicitly named bot bypasses the pool" paragraph in external-servers now says to pass the password with the name and to read it from the environment rather than writing it in the spec.Checked
tsc --noEmitclean inrunner-packageand in the example'se2esources. The stand suite needs a running server, so the two un-excluded tests are for CI to confirm.