Skip to content

RavenDB-27141 Reject two licence sources and fix from_external_server - #40

Open
poissoncorp wants to merge 1 commit into
ravendb:v7.2from
poissoncorp:RavenDB-27141-licensing-and-external-server
Open

RavenDB-27141 Reject two licence sources and fix from_external_server#40
poissoncorp wants to merge 1 commit into
ravendb:v7.2from
poissoncorp:RavenDB-27141-licensing-and-external-server

Conversation

@poissoncorp

Copy link
Copy Markdown
Contributor

Two defects found while syncing the test driver with C# (RavenDB-27141).

python -m unittest discover -s tests

55 tests, all passing.


Fixes

Two licence sources were both passed to the server

ServerOptions.licensing has license (inline JSON) and license_path. They are alternatives. The runner emitted both when both were set, so the server picked one and the mistake stayed invisible. C# raises instead (RavenServerRunner.cs:37-39).

options = ServerOptions()
options.licensing.license = '{"Id": "..."}'
options.licensing.license_path = "license.json"

EmbeddedServer().start_server(options)
# ValueError: Only one of the licence options 'license' or 'license_path' can be set, not both.

The existing test set both and asserted both arguments reached the server, so it pinned the defect in place. It is now two tests, one licence source each, plus one for the rejection.

from_external_server did not run a server directory in place

with_external_server learned to run a directory where it stands, instead of copying it to the default target location. The older from_external_server classmethod never got that, so the same path behaved differently depending on which entry point you used. It now forwards to with_external_server and warns.

options = ServerOptions.from_external_server("/opt/ravendb")
# DeprecationWarning: ServerOptions.from_external_server() is deprecated; construct
# ServerOptions() and call with_external_server(), which also runs a server directory in place.

assert options.target_server_location == "/opt/ravendb"    # was: copied elsewhere
assert options.clear_target_server_location is False       # was: wiped the caller's directory

Deprecations

ServerOptions.from_external_server() still works and emits DeprecationWarning. Use:

options = ServerOptions()
options.with_external_server("/opt/ravendb")

Not in this PR

The default data_directory still points inside the installed package. Commit b8f140d ("RavenDB-27140 Preserve configuration defaults") reverted that deliberately, together with accept_eula and framework_version, and its body is empty, so the reasoning is not recorded anywhere. That needs its author before anyone flips it a second time.

…er through with_external_server

The runner emitted both --License and --License.Path when both were set, letting the server pick one and hiding the mistake; C# raises instead (RavenServerRunner.cs:37-39). from_external_server also predated with_external_server, so it never learned to run a server directory in place.
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.

1 participant