--- title: System tests for pieni.net author: Lars Wirzenius version: 2017-04-21 ... # Introduction This is a system test suite written in [yarn][]. They test the various aspects of my personal server. [yarn]: http://liw.fi/cmdtest/ ## Configuration and running the test suite To run the test suite, specify the server address that is to be tested. In order to be able to run these tests against a new server, before DNS gets updated, the domain names are not hardcoded. Instead, you need to specify the address (IP address or DNS name) of the server, and the tests pretend it has whatever service names in DNS that need to be updated. Do this with: EXAMPLE yarn --env ADDRESS=new.example.com ... # files.liw.fi is where I publish various files I want to share with others. There are no accounts, no passwords. A tiny amount of privacy is available by not having directory listings and choosing semi-random URLs, but mostly I just don't put anything really sensitive there. SCENARIO files.liw.fi GIVEN server is also known as files.liw.fi WHEN user fetches http://files.liw.fi/ THEN HTTP status is 200 AND HTTP body matches "Random files of mine" WHEN user fetches http://files.liw.fi/private/ THEN HTTP status is 200 AND HTTP body matches "Not for you" # code.liw.fi `code.liw.fi` is where I publish my free software projects. There is a directory per project, for project specific files, and a repository of packages for Debian. SCENARIO code.liw.fi GIVEN server is also known as code.liw.fi WHEN user fetches http://code.liw.fi/ THEN HTTP status is 200 AND HTTP body matches "http://liw\.fi/code" WHEN user fetches http://code.liw.fi/debian/ THEN HTTP status is 200 AND HTTP body matches "dists" AND HTTP body matches "pool" `apt.asc` has the signing key for the Debian package archive. WHEN user fetches http://code.liw.fi/apt.asc THEN HTTP status is 200 AND HTTP body matches "-----BEGIN PGP PUBLIC KEY BLOCK-----" # benchmark.obnam.org `benchmark.obnam.org` is where I publish benchmark results from Obnam, a side project of mine. SCENARIO benchmark.obnam.org GIVEN server is also known as benchmark.obnam.org WHEN user fetches http://benchmark.obnam.org/ THEN HTTP status is 200 AND HTTP body matches "Obnam benchmarks" # bugs.liw.fi `bugs.liw.fi` is where I publish a static website showing the status of my distix instance for random personal projects. SCENARIO bugs.liw.fi GIVEN server is also known as bugs.liw.fi WHEN user fetches http://bugs.liw.fi/ THEN HTTP status is 200 AND HTTP body matches "distix" AND HTTP body matches "Lars Wirzenius" # distix.obnam.org `distix.obnam.org` is where I publish a static website showing the status of my Obnam distix instances. SCENARIO distix.obnam.org GIVEN server is also known as distix.obnam.org WHEN user fetches http://distix.obnam.org/ THEN HTTP status is 200 AND HTTP body matches "distix" AND HTTP body matches "obnam-support" AND HTTP body matches "obnam-dev" WHEN user fetches http://distix.obnam.org/obnam-dev/ THEN HTTP status is 200 AND HTTP body matches "distix" AND HTTP body matches "Obnam development" WHEN user fetches http://distix.obnam.org/obnam-support/ THEN HTTP status is 200 AND HTTP body matches "distix" AND HTTP body matches "Obnam" AND HTTP body matches "support" # liw.iki.fi `liw.iki.fi` is where I have an old website and blog. SCENARIO liw.iki.fi GIVEN server is also known as liw.iki.fi WHEN user fetches http://liw.iki.fi/ THEN HTTP status is 200 WHEN user fetches http://liw.iki.fi/ THEN HTTP status is 200 WHEN user fetches http://liw.iki.fi/liw/ THEN HTTP status is 200 WHEN user fetches http://liw.iki.fi/liw/log/index.html THEN HTTP status is 200 WHEN user fetches http://liw.iki.fi/liw/log2/index.html THEN HTTP status is 200 # git.liw.fi `git.liw.fi` is where my git server resides. Over HTTP it exposes cgit for browing public repositories. SCENARIO git.liw.fi GIVEN server is also known as git.liw.fi WHEN user fetches http://git.liw.fi/ THEN HTTP status is 200 AND HTTP body matches "cgit" AND HTTP body matches "obnam" AND HTTP body matches "bumper" It must also have Gitano accessible over ssh. WHEN user runs Gitano help THEN exit code is 0 AND standard error matches "Gitano" Also, it'd be nice if the anonymous git protocol works. WHEN user clones the bumper repository over git:// THEN exit code is 0 # noir.liw.fi `noir.liw.fi` is where I publish my novel. SCENARIO noir.liw.fi GIVEN server is also known as noir.liw.fi WHEN user fetches http://noir.liw.fi/ THEN HTTP status is 200 AND HTTP body matches "Hacker Noir" # docstory.fi `docstory.fi` is something I host for someone else. SCENARIO docstory.fi GIVEN server is also known as docstory.fi WHEN user fetches http://docstory.fi/ THEN HTTP status is 200 AND HTTP body matches "meta.*refresh.*URL=http://filmmaker.docstory.fi" GIVEN server is also known as www.docstory.fi WHEN user fetches http://www.docstory.fi/ THEN HTTP status is 200 AND HTTP body matches "meta.*refresh.*URL=http://filmmaker.docstory.fi" # Mail handling `pieni.net` is what handles all my incoming mail. There are several important addresses on a couple of domains. Let's see if they all work. We do this by sending mail (over SMTP+TLS) and checking it arrives (over IMAP+TLS). For each mail we use a large random number as the subject, making each mail unique and easy to check for. To run these tests we need to be able to log in via IMAP. For this, we'll need passwords, and we will get the passwords with the `pass` utility. Each password should be stored using a name `server-yarns/imap/username@server` where `username` is the user and `server` the address used for IMAP. SCENARIO server handles incoming mail GIVEN server is also known as pieni.net GIVEN large random number R WHEN someone sends mail to postmaster@pieni.net with subject $R THEN mailbox of liw has a mail with subject $R AND mails for liw with subject $R get deleted GIVEN large random number R WHEN someone sends mail to root@pieni.net with subject $R THEN mailbox of liw has a mail with subject $R AND mails for liw with subject $R get deleted GIVEN large random number R WHEN someone sends mail to abuse@pieni.net with subject $R THEN mailbox of liw has a mail with subject $R AND mails for liw with subject $R get deleted GIVEN server is also known as liw.fi GIVEN large random number R WHEN someone sends mail to postmaster@liw.fi with subject $R THEN mailbox of liw has a mail with subject $R AND mails for liw with subject $R get deleted GIVEN large random number R WHEN someone sends mail to abuse@liw.fi with subject $R THEN mailbox of liw has a mail with subject $R AND mails for liw with subject $R get deleted GIVEN large random number R WHEN someone sends mail to liw-passthrough@liw.fi with subject $R THEN mailbox of liw has a mail with subject $R AND mails for liw with subject $R get deleted WHEN someone sends mail to bugs-passthrough@liw.fi with subject $R THEN mailbox of distix has a mail with subject $R AND mailbox of liw has a mail with subject $R AND mails for distix with subject $R get deleted AND mails for liw with subject $R get deleted `pieni.net` needs to accept mail from my various machines, and relay them anywhere. However, only from my machines, not any random spammer. SCENARIO mail relaying is denied WHEN client sends MAIL FROM:root@code.liw.fi AND client sends RCPT TO:liw@iki.fi THEN SMTP status code is 554 SCENARIO mail relaying is allowed for pienirelay WHEN client SMTP authenticates as pienirelay AND client sends MAIL FROM:root@code.liw.fi AND client sends RCPT TO:liw@iki.fi THEN SMTP status code is 250