Skip to content

Enable VaadinService initialization for unit tests with a server key in commercially maintained versions #25075

Description

@Legioth

Describe your motivation

"Browserless" unit testing relies on initializing a mock Vaadin environment. In a commercially maintained Vaadin version, this runs into the license check in VaadinService when running in development mode.

In some cases, those unit tests rely on debug features that are only available when development mode is enabled. This leads to a problem since the development mode license check doesn't accept the server key that should be used on e.g. CI servers.

This becomes a problem for a user that has built in an assumption for dev mode features in their unit tests while using a free version of Vaadin and subsequently switches to a commercially maintained version. This issue was originally encountered by a customer with Karibu tests when updating from Vaadin 24.9.18 to 24.9.19.

Describe the solution you'd like

It should be possible to initialize VaadinService in unit tests with a server key without disabling dev mode debugging features. At the same time, we should be careful to not enable general Vaadin development with a server key since that would make it trivial to bypass the seat count limitations in our commercial subscriptions.

One way of achieving this would be to introduce an additional configuration flag, e.g. unitTestDevelopmentMode. This flag would do three things when enabled:

  1. Trigger a hard error in case production mode is explicitly enabled to help detect configuration mismatches.
  2. Bypass the VaadinService license check in the same way as if production mode is enabled.
  3. Disable some core feature that is essential for rendering the application in the browser but isn't used for browserless unit tests. One candidate to disable could be index html page serving and the corresponding embedded web component embedding mechanism.

Describe alternatives you've considered

Another alternative could be to introduce additional configuration flags for specific debug features so that they can be selectively enabled even when production mode is enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Complexity: MediumA task requires medium efforts for solving

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions