Commit Graph

86 Commits

Author SHA1 Message Date
Ryan Gonzalez
33a2f70d07 system-test: Allow skipping coverage
Enabling coverage near-doubles the incremental build time and adds
overhead to individual tests on the order of **5-10x** or more. It's not
essential to have this for quick local system-test runs, so add an option
to disable it.
2025-09-23 16:25:46 -05:00
Ryan Gonzalez
29ac9c1919 system-test: Fix crash when a comparison with a non-string value fails
`orig` isn't necessarily a string, so the string concatenation here can
raise a TypeError.
2025-09-23 16:25:46 -05:00
André Roth
1566e193f6 system-test: enable faketime optionally per test 2025-06-09 13:17:54 +02:00
André Roth
22bc2f9d0f system-tests: improve sorted compare
sort both aptly output and gold file. output original output for
debugging on failure.

* Makefile: enable CAPTURE=1 env variable for capturing gold files
* docker-system-test: use AWS env vars for S3 tests
* fix system tests timing issue with order of gpg logs in publish tests
2025-04-25 00:51:59 +02:00
André Roth
e92afd8f78 fix unit tests on arm
and fix etcd data dir
2024-12-11 10:40:44 +01:00
André Roth
280563caa8 unit-tests: allow running as user 2024-12-11 10:40:44 +01:00
Mauro Regli
03f189b62c add first test of addon files 2024-11-17 14:09:37 +01:00
Christoph Fiehe
bd64232eb6 Allow management of components
This commit allows to add, remove and update components of published repositories without the need to recreate them.

Signed-off-by: Christoph Fiehe <c.fiehe@eurodata.de>
2024-10-22 16:58:15 +02:00
André Roth
14a343a0d7 system tests: support fitureCmds and allow dirmgr to startup
- fixes a race condition, where dirmgr does not seem to  be ready
- imports secret key for signing if gpg2 is used
2024-10-08 15:38:42 +02:00
André Roth
b2b7f11d17 ci: remove pip and virtualenv
- separate unit tests, benchmark, system tests, flake8
2024-10-04 15:56:57 +02:00
André Roth
98b1ed07d1 docker: improve dev env
- abort docker scripts on error
- generate version in system tests
- build debian packages in docker
- add make clean target
- fix lint
2024-09-24 10:14:39 +02:00
André Roth
b342af0d96 system tests: fix gpgv warning when verifying signatures
gpgv: can't allocate lock for '/home/runner/.gnupg/aptlytest.gpg'

this forced running local system tessts in /home/runner, as it is
in the gitgub actions.
2024-09-24 10:14:39 +02:00
André Roth
640c202ee5 etcd: implement separate system tests
- add t13_etcd test directory
- etcd will be started for the unit tests and each system test
- etcd will load fixture DB export if requested by the test
- existing tests are reused for etcd testing
2024-07-31 22:16:00 +02:00
hudeng
59bf4501e8 feat: Use databaseBackend config repace databaseEtcd
databaseBackend config contains type and url sub config, It can facilitate the expansion of other types of databases in the future.
2024-07-31 22:16:00 +02:00
hudeng
f29449db14 feat: Add system test for etcd 2024-07-31 22:16:00 +02:00
André Roth
4a0bdcbb64 improve system tests
- log import errors for test modules
- log output only on test failure
- improve docker system test container
- use go 1.19 in docker system tests
- download go dependencies in docker container
- system tests: color failues output
- imrpove test result output
- do not install golangci-lint in system tests
2024-07-24 21:19:47 +02:00
André Roth
440c3debdc improve api tests and error output
show only relevant aptly logs if a test fails.
for async tasks, show task output, as it contains the error message.
2024-07-24 21:19:47 +02:00
Ryan Gonzalez
b5bf2cbcda Fix functional tests' '--capture' on Python 3
None of the commands' output is ever treated as binary, so we can just
always decode it as text.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2024-06-17 11:51:18 +02:00
André Roth
d8cfafccc9 system tests: improve log output 2024-06-15 19:18:14 +02:00
André Roth
9deb031c44 fix system tests
- use s3 mirror instead of internet download
- reduce download verbosity
- do not use venv in docker-system-tests
- be more verbose on test output
- do not run golangci-lint in system-tests
2024-04-11 10:15:02 +02:00
André Roth
d7cc9b89d1 system tests: use repository mirrors on S3 for reproducibility
no direct internet download from apt repositories,
which over time will change or cease to exist.

also migrate to gpg2 on newer ubuntu.
2024-02-05 13:04:45 +01:00
Ryan Gonzalez
ed45c44931 Fix the test output regex on Go 1.20
1.20 changes the output format of coverage checks slightly to include
a package name on each line, followed by `coverage:`, but the current
regex assumes that the line *starts* with `coverage:`.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2023-10-03 08:31:39 +02:00
Ryan Gonzalez
889fcc2158 Improve test output regex for better perf
The current regex runs in exponential time, which massively impacts the
runtime of the test suite, taking several seconds (~4s on my system)
just to perform a single match. By replacing the mix of re.findall + the
initial capture group with re.search + some string slicing, the time
spent matching the regex becomes nearly instant, e.g.:

    $ make system-test TESTS='Config*'

goes from taking ~10s to ~1.5s.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2023-10-03 08:31:39 +02:00
Mauro Regli
7c8dd7362d Fix: Missing newline makes tests fail 2023-05-15 11:15:48 +02:00
Markus Muellner
0fdba29d51 make serving published repos in api mode configurable 2023-03-22 17:22:54 +01:00
Markus Muellner
f74217ed9c implement system tests for serving api and published repos simultaneously 2023-03-22 17:22:54 +01:00
Markus Muellner
8e62195eb5 implement structured logging 2023-02-20 13:42:50 +01:00
Benj Fassbind
ff3bf4b180 Improve error messages 2022-07-13 08:33:48 +02:00
Benj Fassbind
1d4e6183be Capture coverage of integration tests
To capture the coverage also for the integration tests,
a test only executing the cmd.Run function is used.

The test always exits with code 0 and prints the
real exit code to stdout. Otherwise no coverage
report is generated.

Those changes enable a more accurate coverage report
for future contributions.
2022-07-13 08:33:48 +02:00
Markus Muellner
db19a56458 Add functional test for metrics endpoint 2022-04-12 14:39:16 +02:00
Lorenzo Bolla
035d5314b0 Convert tests to Python 3
Fix #938
2022-01-27 15:06:33 +01:00
Lorenzo Bolla
70f7d7409a Allow to check for empty output in tests 2022-01-27 09:30:14 +01:00
Lorenzo Bolla
48635c8057 Strip irrelevant lines from test output
It may happen that aptly retries to download data during tests (maybe because
of a network issue), but our fixtures doesn't account for it. So, we strip
those irrelevant lines before comparison.
2022-01-27 09:30:14 +01:00
Ximon Eighteen
8e309b57b3 Workaround differences in the GHA Ubuntu 18.04 environment compared to the Travis CI Ubuntu 16.04 environment. 2022-01-27 09:30:14 +01:00
Lorenzo Bolla
787cc8e3ee Fix system tests 2022-01-27 09:30:14 +01:00
Frank Steinborn
98e75f6d97 Make database open attempts configurable also via config file 2019-09-03 00:52:24 +03:00
Andrey Smirnov
f0a370db24 Rework HTTP downloader retry logic
Apply retries as global, config-level option `downloadRetries` so that
it can be applied to any aptly command which downloads objects.

Unwrap `errors.Wrap` which is used in downloader.

Unwrap `*url.Error` which should be the actual error returned from the
HTTP client, catch more cases, be more specific around failures.
2019-08-07 20:23:05 +03:00
Andrey Smirnov
ca5b7758ce Print when test is skipped 2019-07-11 00:49:36 +03:00
Andrey Smirnov
61e00b5fbd Test updates for Travis CI
Travis is running Trusty with GPG 2.0.x, which is
much different from 2.1.x.

Add tests for default key signing.

Add test for gpg1/2 in functional.
2018-10-10 01:34:58 +03:00
Andrey Smirnov
1b2fccb615 Compatibility with GnuPG 1.x and 2.x, auto-detect GnuPG version
* aptly can sign and verify without issues with GnuPG 1.x and 2.x
* aptly auto-detects GnuPG version and adapts accordingly
* aptly automatically finds suitable GnuPG version

Majority of the work was to get unit-tests which can work with GnuPG 1.x & 2.x.
Locally I've verified that aptly supports GnuPG 1.4.x & 2.2.x. Travis CI
environment is based on trusty, so it runs gpg2 tests with GnuPG 2.0.x.

Configuration parameter gpgProvider now supports three values for GnuPG:

* gpg (same as before, default): use GnuPG 1.x if available (checks gpg, gpg1),
otherwise uses GnuPG 2.x; for aptly users who already have GnuPG 1.x
environment (as it was the only supported version) nothing should change; new
users might start with GnuPG 2.x if that's their installed version

* gpg1 looks for GnuPG 1.x only, fails otherwise

* gpg2 looks for GnuPG 2.x only, fails otherwise
2018-10-10 01:34:00 +03:00
Oliver Sauder
108b0ea226 Add support to mirror non package installer files 2018-07-06 15:02:37 +02:00
Andrey Smirnov
d76259496d Disable FTP tests in Travis 2018-03-16 11:32:22 +03:00
Andrey Smirnov
359cda9d99 Add system test for repo with SHA512-only checksums 2017-11-08 19:45:22 +03:00
Harald Sitter
f43801cb96 whitelist falke E722 in system/lib.py
'E722 do not use bare except' wants us not to use except without type
restriction as it catches everything and the kitchen sink. Since we use
them to catch exceptions in test cases this is intentional as we implement
general purpose error handling on test failure there.
2017-10-31 12:42:11 +01:00
Andrey Smirnov
f54e798eac Add system test for fixed checksum matching 2017-05-23 03:00:16 +03:00
Andrey Smirnov
c798db8056 Add system's requirements.txt, enforce flake8 linter
Fix style issues in functional tests.
2017-04-28 00:05:11 +03:00
jolo
96948d6f18 Basic test of graph layout 2017-01-17 00:46:51 +01:00
Andrey Smirnov
4e3284cd98 Check contents of contents index being generated. #142 2015-04-02 01:19:51 +03:00
Andrey Smirnov
103fa5310f First pack of system tests for aptly repo include. #71 2015-03-16 22:50:58 +03:00
Andrey Smirnov
eb0443ed51 Tests for publish list API + verify that publishing actually creates files. #116 2015-03-03 20:35:48 +03:00