Skip to main content

Test environment

The repository has a ready-made test environment in testenv/: the latest letreset/pagetto image with feeds, accounts, groups, permissions and packages already set up. Use it to try a change, reproduce a bug or run the UI checks without setting anything up by hand.

Start it​

You need Docker with Compose. From the repository root:

docker compose -f testenv/docker-compose.yml up -d

Open http://localhost:5000 and sign in with one of the test accounts.

The committed snapshot (testenv/data: the SQLite database and the package files) is mounted read-only and copied into a Docker volume on the first start, so nothing you do in the environment changes the working tree. To throw away all changes and start from the snapshot again:

docker compose -f testenv/docker-compose.yml down -v
VariableDefaultDescription
PAGETTO_TAGlatestImage tag to test, e.g. 1.0.0 or a prerelease
PAGETTO_PORT5000Port on the host
TESTENV_EMPTY01 starts with an empty database instead of the snapshot

The server runs in the ASP.NET Core Development environment: errors show a detailed error page instead of a bare status code, sign-in cookies also work over plain HTTP (for example when you open it through a LAN address instead of localhost), and HSTS is off. Production servers must not use Development.

To test your own build instead of a published image, build it with docker build -t letreset/pagetto:dev . and start the environment with PAGETTO_TAG=dev.

Test accounts​

These credentials exist only in the test data. Never use them for a real server.

UserPasswordGroupsNotes
adminAdmin-Test-Password-1Administrator
aliceUser-Test-Password-1Developers, Package owners
bobUser-Test-Password-1Developers
carolUser-Test-Password-1Developers
build-agentUser-Test-Password-1Build agentsCan't sign in to the web UI, only NuGet clients

What's in it​

FeedContentsSettings
DefaultNo packagesA mirror of nuget.org, so a restore or a package page pulls packages in (needs internet)
Internal22 Contoso.* packages, enough for two pages of results. Contoso.Logging has three versions (1.4.0 unlisted), symbol packages and a dependency on Contoso.CoreOverwrite policy Prerelease only, keep at most 3 major versions
ExperimentalPrerelease packages (Contoso.Messaging 1.1.0-beta.2, Contoso.Preview.Ai)Hard delete, keep at most 5 prerelease versions
ArchiveContoso.LegacyRead-only
DartA Dart feed with contoso_core, contoso_http (two versions that differ only in build metadata) and contoso_widgets (a prerelease). contoso_core 1.0.0 is retractedA mirror of pub.dev (needs internet)

Some versions have been downloaded a few times (Contoso.Core and Contoso.Logging the most), so download counts and the statistics page have data. The audit log starts with the events from building the data set (uploads, groups, permissions and feed settings by admin).

GroupMembersPermissions
Developersalice, bob, carolPull on Default, Internal, Archive and Dart; pull, push and delete on Experimental
Package ownersalicePull, push and delete on Internal and Dart
Build agentsbuild-agentPull on Default; pull and push on Internal, Experimental and Dart

The packages are in testenv/packages, so you can push them again to try uploads. Local accounts authenticate with their username and password (Basic auth), for example:

curl -u carol:User-Test-Password-1 -X PUT -F package=@testenv/packages/Contoso.Mail.1.0.0.nupkg http://localhost:5000/feeds/experimental/api/v2/package

With the dotnet CLI, add the feed as a source with --username and --password first (see Connecting a client).

The Dart test packages are in testenv/packages/dart, as the archives dart pub publish uploads.

UI checks​

testenv/UI-TESTS.md lists the checks to run in the browser after UI changes and before a release, each with the account to use and the expected result. Checks that currently fail link to their issue, so a new failure stands out.

Change the data set​

The data set is built by testenv/seed/seed.mjs, which packs the test packages (the NuGet ones from testenv/seed/template) and fills an empty server through the web UI forms, the NuGet API and the pub API. Edit it, then regenerate the snapshot as described in testenv/README.md. Regenerate it too when a release changes the database schema in a way PaGetto can't migrate the snapshot from.