summaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* main: add support for CLI extensions via external binariesLuca BRUNO2021-12-201-0/+27
| | | | | | | | | | This adds some logic to detect and dispatch unknown subcommands to extensions available in `$PATH`. Additional commands can be implemented by adding relevant `ostree-$verb` binaries to the system. As an example, if a `/usr/bin/ostree-extcommand` extension is provided, the execution of `ostree extcommand --help` will be dispatched to that as `ostree-extcommand extcommand --help`.
* tests: assert mandatory values are presentLuca BRUNO2021-12-101-2/+4
| | | | | This adds a couple of string assertions to make sure that the test run is sane.
* Update FSF license notices to use URL instead of addressJoseph Marrero2021-12-07140-421/+141
|
* lib: misc static analysis fixesLuca BRUNO2021-11-261-0/+1
| | | | | This fixes a few warnings from coverity, none of which really interesting.
* tests/var-mount: tweak test setupLuca BRUNO2021-10-191-6/+3
| | | | | | | | This reworks the var-mount destructive test in order to properly use the datadir for the current stateroot instead of a duplicated one. In turn, it ensures that the resulting `var.mount` after reboot is correctly pointing to the same location which hosted `/var` on the previous boot.
* tests/rollsum: Use `g_malloc` not `malloc`Colin Walters2021-10-181-2/+2
| | | | To pacify gcc's `-fanalyzer`.
* Merge pull request #2459 from smcv/test-commit-signColin Walters2021-10-061-2/+6
|\ | | | | test-commit-sign.sh: Skip a unit test when running as an installed-test
| * test-commit-sign.sh: Skip a unit test when running as an installed-testSimon McVittie2021-10-051-2/+6
| | | | | | | | Signed-off-by: Simon McVittie <smcv@debian.org>
* | Release 2021.5v2021.5Colin Walters2021-10-051-1/+1
|/
* deploy: Ignore sockets, fifos in /etc during mergeColin Walters2021-10-012-0/+27
| | | | | | | | | | | https://bugzilla.redhat.com/show_bug.cgi?id=1945274 is an issue where a privileged kubernetes daemonset is writing a socket into `/etc`. This makes ostree upgrades barf. Now, they should clearly move it to `/run`. However, one option is for us to just ignore it instead of erroring out. Some brief investigation shows that e.g. `git add somesocket` is a silent no-op, which is an argument in favor of ignoring it. Closes: https://github.com/ostreedev/ostree/issues/2446
* Merge pull request #2450 from cgwalters/revdep-ext-ciJonathan Lebon2021-09-303-12/+12
|\
| * tests: Use ostree-ext 0.3.0Colin Walters2021-09-303-12/+12
| | | | | | | | | | This updates to the modern glib 0.14 and paves the way for some reverse dependency testing by using ostree-ext's code.
* | bin/commit: Fix --tree=tar with --selinux-policyColin Walters2021-09-301-0/+13
|/ | | | | | | | | | | | The logic for `--selinux-policy` ended up in the `--tree=dir` path, but there's no reason for that. Fix the imported labeling with `--tree=tar`. Prep for use with containers. We had this bug because the previous logic was trying to avoid duplicating the code for generic `--selinux-policy` and the case of `--selinux-policy-from-base --tree=dir`. It's a bit more code, but it's cleaner if we dis-entangle them.
* tests: Add new TAP APIsColin Walters2021-09-102-4/+15
| | | | | | | | | | | Having to touch a global test counter when adding tests is a recipe for conflicts between PRs. The TAP protocol allows *ending* with the expected number of tests, so the best way to do this is to have an explicit API like our `tap_ok` which bumps a counter, then end with `tap_end`. I ported one test as a demo.
* tests/pull-test: Avoid duplicating test numbersColin Walters2021-09-101-3/+4
| | | | | We do this in other places; avoids touching two numbers when adding tests. Let computers do the addition.
* Release 2021.4Colin Walters2021-09-081-1/+1
|
* Merge pull request #2434 from cgwalters/custom-remoteColin Walters2021-09-081-2/+29
|\ | | | | Add support for "custom remotes"
| * Add support for "custom remotes"Colin Walters2021-09-081-2/+29
| | | | | | | | | | | | | | | | | | | | This will be helpful for the "ostree native container" work in https://github.com/ostreedev/ostree-rs-ext/ Basically in order to reuse GPG/signapi verification, we need to support adding a remote, even though it can't be used via `ostree pull`. (At least, not until we merge ostree-rs-ext into ostree, but even then I think the principle stands)
* | upgrade: Stabilize deployment stagingColin Walters2021-09-071-4/+1
|/ | | | | | | | | | We're waaay overdue for this, it's been the default in rpm-ostree for years, and solves several important bugs around not capturing `/etc` while things are running. Also, `ostree admin upgrade --stage` (should) become idempotent. Closes: https://github.com/ostreedev/ostree/issues/2389
* tests: skip a broken fsck caseLuca BRUNO2021-09-061-1/+4
| | | | | | There are some existing issues around fsck in unprivileged bare mode, so this test does not really work at the moment. Leaving it as a FIXME for the moment.
* tests/basic: avoid changing ownershipLuca BRUNO2021-09-061-1/+1
| | | | | This avoids possible issues when trying to chmod, tweaking permissions instead.
* tests/basic: Skip --no-xattrs if we have selinuxColin Walters2021-09-061-1/+8
| | | | | | | | | It cannot work to use `--no-xattrs` when SELinux is enabled because we get a `security.selinux` attribute on created files regardless. So just skip this test if true. Also add some `ostree fsck`s in here which helped me debug this.
* libtest: tweak selinux/relabel messageLuca BRUNO2021-09-061-1/+1
|
* Add an API to verify a commit signature explicitlyColin Walters2021-08-304-2/+132
| | | | | | | | | | | | | We have a bunch of APIs to do GPG verification of a commit, but that doesn't generalize to signapi. Further, they require the caller to check the signature status explicitly which seems like a trap. This much higher level API works with both GPG and signapi. The intention is to use this in things that are doing "external pulls" like the ostree-ext tar import support. There we will get the commitmeta from the tarball and we want to verify it at the same time we import the commit.
* tests: update several bare-user-only checksLuca BRUNO2021-08-242-26/+18
|
* bin/remote: Rename list-gpg-keys to gpg-list-keysDan Nicholson2021-08-231-7/+7
| | | | | | | | | | | | | | | As pointed out in the original review, `gpg-list-keys` fits better alongside the existing `gpg-import`. Changes were done with: ``` git grep -l list-gpg-keys | xargs sed -i 's/list-gpg-keys/gpg-list-keys/' for src in $(git ls-files '*list-gpg-keys*'); do dst=${src/list-gpg-keys/gpg-list-keys} git mv "$src" "$dst" done ```
* Merge pull request #2412 from lucab/ups/lib-commit-canonicalizeColin Walters2021-08-202-2/+14
|\ | | | | lib/commit: autofix permissions for bare-user-only
| * lib/commit: autofix permissions for bare-user-onlyLuca BRUNO2021-08-202-2/+14
| | | | | | | | | | This tweaks commit logic to detect bare-user-only repositories and canonicalize permissions automatically.
* | Merge pull request #2401 from dbnicholson/gpg-key-infoColin Walters2021-08-201-0/+152
|\ \ | |/ |/| Remote GPG key info
| * bin/remote: Include update URLs in list-gpg-keysDan Nicholson2021-07-151-0/+8
| |
| * bin/remote: Add list-gpg-keys subcommandDan Nicholson2021-07-151-0/+144
| | | | | | | | | | | | | | | | This provides a wrapper for the `ostree_repo_remote_get_gpg_keys` function to show the GPG keys associated with a remote. This is particularly useful for validating that GPG key updates have been applied. Tests are added, which checks the `ostree_repo_remote_get_gpg_keys` API by extension.
* | lib/repo/checkout: use canonical perms in bare-user-only modeLuca BRUNO2021-08-192-5/+18
| | | | | | | | | | This automatically enables canonical permissions for checkouts in bare-user-only mode.
* | builtins/commit: check for conflicting permissions optionsLuca BRUNO2021-08-181-1/+1
| | | | | | | | | | | | This explicitly checks for commit command options asking for both non-zero UID/GID and canonical permissions at the same time, which are incompatible.
* | lib/sign-dummy: Handle incorrect signatures correctlyJonathan Lebon2021-08-031-1/+1
| | | | | | | | | | | | | | We need to check all signatures for one which passes, not just fail on the first one. Reported-by: Seth Arnold <seth.arnold@canonical.com>
* | tests: Unset SOURCE_DATE_EPOCHSimon McVittie2021-07-261-0/+4
|/ | | | | | | | | | | | | Some distributions set this during build in order to have reproducible builds from the same source code: for example, Debian uses the date from debian/changelog. However, some of our tests assume that `ostree commit` will result in a commit with the current date/time, and SOURCE_DATE_EPOCH breaks that assumption. Unset it for our build-time tests. Resolves: https://github.com/ostreedev/ostree/issues/2405 Signed-off-by: Simon McVittie <smcv@collabora.com>
* Release 2021.3v2021.3Luca BRUNO2021-07-121-1/+1
|
* lib/commit: respect SOURCE_DATE_EPOCH for commit timestampLuca BRUNO2021-06-221-0/+45
| | | | | | | | | This tweaks `ostree_repo_write_commit` so that it checks for the envinroment variable `SOURCE_DATE_EPOCH` as a way to override the current time, which is used as the commit timestamp. Ref: https://reproducible-builds.org/docs/source-date-epoch/ Ref: https://reproducible-builds.org/specs/source-date-epoch/
* libtest.sh: Remove duplicate ERR trap and report_err()Simon McVittie2021-06-221-8/+0
| | | | | | | Since #2377 was merged, this is in libtest-core.sh, which is sourced by libtest.sh. Signed-off-by: Simon McVittie <smcv@collabora.com>
* Merge pull request #2377 from smcv/libtest-coreColin Walters2021-06-211-1/+28
|\ | | | | libtest-core: Add some improvements from bubblewrap
| * libtest-core: Mention bubblewrap as a user of this fileSimon McVittie2021-06-181-0/+1
| | | | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
| * libtest-core: Update URL of rpm-ostreeSimon McVittie2021-06-181-1/+1
| | | | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
| * libtest-core: On failure, make it clearer what has happenedSimon McVittie2021-06-181-0/+8
| | | | | | | | | | | | | | | | If we fail as a result of `set -x`, It's often not completely obvious which command failed or how. Use a trap on ERR to show the command that failed, and its exit status. Signed-off-by: Simon McVittie <smcv@collabora.com>
| * libtest-core: Add assert_files_equalAlexander Larsson2021-06-181-0/+18
| | | | | | | | | | | | [Originally from bubblewrap commits c5c999a7 "tests: test --userns" and 3e5fe1bf "tests: Better error message if assert_files_equal fails"; separated into this commit by Simon McVittie.]
* | Use generator to enable ostree-remount.service and ostree-finalize-staged.pathColin Walters2021-06-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We struggled for a long time with enablement of our "internal units", trying to follow the philosophy that units should only be enabled by explicit preset. See https://bugzilla.redhat.com/show_bug.cgi?id=1451458 and https://github.com/coreos/rpm-ostree/pull/1482 etc. And I just saw chat (RH internal on a proprietary system sadly) where someone hit `ostree-remount.service` not being enabled in CentOS8. Thinking about this more, I realized we've shipped a systemd generator for a long time and while its only role until now was to generate `var.mount`, but by using it to force on our internal units, we don't require people to deal with presets anymore. Basically we're inverting things so that "if ostree= is on the kernel cmdline, then enable our units" and not "enable our units, but have them use ConditionKernelCmdline=ostree to skip". Drop the weird gyrations we were doing around `ostree-finalize-staged.path` too; forking `systemctl start` is just asking for bugs. So after this, hopefully we won't ever again have to think about distribution presets and our units.
* | deploy: Warn if we find content in the deployment's /varColin Walters2021-06-101-0/+13
| | | | | | | | | | | | | | | | | | | | | | This will be ignored, so let's make it very clear people are doing something wrong. Motivated by a bug in a build pipeline that injected `/var/lib/rpm` into an ostree commit which ended up crashing rpm-ostree because it was an empty db which it wasn't expecting. It *also* turns out rpm-ostree is incorrectly dumping content in the deployment `/var` today, which is another bug.
* | tests: Add single process repo locking testsDan Nicholson2021-06-051-0/+306
| | | | | | | | | | | | | | | | | | | | The semantics of multiple process locking are covered by test-concurrency.py, but the semantics of the repository locking from a single process aren't handled there. This checks how the repository locking is handled from a single thread with one OstreeRepo, a single thread with multiple OstreeRepos, and multiple threads sharing an OstreeRepo.
* | test-concurrency: Lower lock timeoutDan Nicholson2021-06-051-2/+6
| | | | | | | | | | | | | | If there's a locking issue in this test, then it's likely not going to resolve after a few seconds of serializing access. Lower the default 30 second lock timeout to 5 seconds to prevent the test from hanging unnecessarily.
* | repo: Require lock type in ostree_repo_lock_popDan Nicholson2021-06-051-3/+3
| | | | | | | | | | | | | | | | This simplifies the lock state management considerably since the previously pushed type doesn't need to be tracked. Instead, 2 counters are kept to track how many times each lock type has been pushed. When the number of exclusive locks drops to 0, the lock transitions back to shared.
* | repo: Make locking APIs publicColin Walters2021-06-052-0/+34
| | | | | | | | | | | | | | | | Doing anything even somewhat sophisticated requires this; turns out our own `ostree prune` CLI wants this, e.g. https://github.com/ostreedev/ostree/issues/2337 Closes: https://github.com/ostreedev/ostree/issues/2286
* | tests/gpg: Don't assert subkey expiration when only primary expiredDan Nicholson2021-05-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In gnupg 2.3.0[1], if a primary key is expired and a subkey does not have an expiration or its expiration is older than the primary key, the subkey's expiration will be reported as the primary's. Previously a subkey without an expiration would not report one regardless of the primary key's expiration. This caused a regression in a test setting an expiration on a primary key. The test was checking that the subkey was not expired by asserting that there was no `Key expired` line in the signature verification output. With gnupg 2.3.0+, it will show as expired, causing the test to fail. Remove the assertion since it's not consistent across gnupg versions. In practice we don't care whether the subkey is considered expired or not as long as the signature verification fails when the primary key is expired. 1. https://dev.gnupg.org/T3343 Fixes: #2359