Identica
Live tests

Live tests

Run and write player journeys against the packaged plugin on a real proxy.

The identica-testing module starts the packaged plugin and providers on a real Velocity or BungeeCord proxy with Paper backends and drives simulated players through them with Anvil. Unit tests stay in their own modules; these tests cover what a player experiences when joining.

Run the tests

Run from the repository root; a Java 21 must be installed on the machine:

./gradlew :identica-testing:anvil

The task runs every suite. It builds the plugin and provider jars, downloads the proxy and server distributions on first use, and starts a fresh proxy for every test. The first run takes several minutes; later runs reuse the downloads and Identica's own libraries. ./gradlew test and pluginJars do not start these tests.

The auth and lobby servers are not part of what a test checks, so they start once and serve one test after another; only the proxies, with the plugin, their files and their database, are new in every test. A test that fails stops the servers it used, keeps their folders next to its own, and the next test starts new ones.

Several tests run at once, each on its own network: one for every four processors of the machine, four at most. Set another number with -Pidentica.journeys.parallelism=1. The server and proxy processes run with a lowered priority and each assumes four processors, so the machine stays usable during a run.

Suites

The journeys are split into suites. Each suite is a JUnit tag on the test classes of its packages and has a task of its own:

SuiteTaskPackagesCovers
joinanvilJoinTestjoin, entrypoint, routing, restrictiongetting a player in: registration, login, premium detection, hostnames and routing targets
accountanvilAccountTestcredential, verification, recognition, securityan account once it exists: password changes, two-factor verification, recognised sessions, protection against abuse
identityanvilIdentityTestusername, identityusernames and their conflicts, unique ids, reservations
operationsanvilOperationsTestadministration, migration, startup, database, examplereloads, migrations, startup, database backends, the examples
clusteranvilClusterTestclustertwo proxies sharing a database; needs Docker
upgradeanvilUpgradeTestupgradestarting from what an earlier version of Identica left
platformanvilPlatformTestplatformproxies other than Velocity: joining through BungeeCord

./gradlew :identica-testing:anvil runs every suite. Pull requests run every suite but upgrade, each in a job of its own; releases run upgrade as well.

Run one package, class or test of a suite with --tests:

./gradlew :identica-testing:anvilJoinTest --tests 'me.whereareiam.identica.testing.routing.*'
./gradlew :identica-testing:anvilJoinTest --tests '*CredentialFirstJoinTest'

A new test class carries the tag of its package's suite, such as @Tag("join"); @IdenticaCluster carries the cluster tag itself. The suites are listed in journeySuites of the module's build. anvilTest runs what no suite claims, which is only JourneySuitesTest: it fails when a journey belongs to no suite or to more than one.

The upgrade journeys start a proxy on what an earlier version of Identica left, such as the database of Identica 2.2.1. Such a journey places the earlier files with ProxyConfiguration.seed. The databases come from EarlierInstallation, in the test fixtures of each schema's owner, and the configuration directories from EarlierConfiguration, in the test fixtures of identica-common, which lists the layouts of 2.2.1 and of the development builds. A journey that seeds a configuration directory omits the documents the test network would otherwise write in this version's layout.

anvilScenarios lists the scenarios, anvilRun --scenario=<name> starts one to look around in, and anvilLogin --account=<id> and anvilLogout --account=<id> manage the accounts Anvil signs in with.

When a test fails, its network is kept under identica-testing/build/anvil/<scenario>/<run>/. Each process folder holds an anvil-console.log, and Identica's debug logging is enabled in every test network.

Next steps

  • Writing journeys: declare a network, describe a player, and check what they see
  • Networks: journeys across several proxies and on BungeeCord

On this page