foundationdb/contrib/pkg_tester
Andrew Noyes 9f8e2a4517
Test compiling an fdb_c app in pkg_tester (#6940)
* Use execstack to test executable stack permissions

The output of readelf wasn't stable

* Tee output to stdout in pkg_tester "run" function

* Test compiling an app that includes fdb_c.h

Featuring both cmake and pkg_tester, since we intend to support those in
our packages.

* Fix packaging bug

The libdir in the pkg-config file in the packages was wrong
2022-04-26 11:54:52 -07:00
..
__snapshots__ Test compiling an fdb_c app in pkg_tester (#6940) 2022-04-26 11:54:52 -07:00
README.md Tests pass for versioned packages 2021-08-19 16:32:22 +00:00
requirements.txt Basic tests for rpm and deb packages 2021-08-19 16:32:22 +00:00
test_fdb_pkgs.py Test compiling an fdb_c app in pkg_tester (#6940) 2022-04-26 11:54:52 -07:00

README.md

pkg_tester

This is a test suite that can be used to validate properties of generated package files.

To use it, first build the package files as described in the main README

Then setup a virtualenv:

$ python3 -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt

Then you can run the tests with pytest:

$ BUILDDIR=<BUILDDIR> python -m pytest -s -v

These are snapshot tests, so you may need to update the snapshots with

$ BUILDDIR=<BUILDDIR> python -m pytest -s -v --snapshot-update

Use discretion about whether or not the behavior change is acceptable.

A helpful tip for debugging: if you run pytest with --pdb, then it will pause the tests at the first error which gives you a chance to run some docker exec commands to try and see what's wrong.

There's a small chance that this will leak an image (especially if you interrupt the test with ctrl-c). Consider running

$ docker image prune

after. If you kill -9 the test, there might even be leaked containers. You can destroy all existing containers with

$ docker rm -f $(docker ps -a -q) # destroy all docker containers!

Requirements

docker, python

Future work?

  • Test rpms
  • Test debs
  • Test versioned packages
  • Test that upgrades preserve data/config

Development

Please run black and mypy after making changes