freight-team / freight

A modern take on the Debian archive.
Other
107 stars 37 forks source link

Test suite: problems with gpg keys #101

Closed yegorich closed 3 years ago

yegorich commented 4 years ago

What are the exact requirements to run a test suite? All the tests (beginning with the freight-cache builds distro Release/InRelease file) that require a key fail with the following message:

gpg: skipped "freight@example.com": No secret key
gpg: signing failed: No secret key

I have created such a key myself and it is listed via gpg --list-keys. Nevertheless, it will be ignored during the test.

yegorich commented 4 years ago

I got a little bit further. After removing the tmp folder, I have realized that I'll be asked for a password for the keys (I'm working over SSH but the password was asked on the desktop and not in the shell). So now all tests except apt-get are working.

The error message is as follows:

✗ apt-get fetches package list
   (in test file test/apt_cache.bats, line 61)
     `apt-get -c ${FIXTURES}/apt.conf update' failed with status 100
   # [freight] added /home/user/Documents/versioned/freight/test/fixtures/test_1.0_all.deb to apt/example
   # [freight] added /home/user/Documents/versioned/freight/test/fixtures/test_1.0_all.deb to apt/example/comp
   apt-get is /usr/bin/apt-get
   *Ver: Standard .deb
   # [freight] adding test_1.0_all.deb to pool
   # [freight] adding test_1.0_all.deb to pool
   Get:1 file:/home/user/Documents/versioned/freight/test/tmp/freight/var/cache example InRelease [5,415 B]
   Get:1 file:/home/user/Documents/versioned/freight/test/tmp/freight/var/cache example InRelease [5,415 B]
   Err:1 file:/home/user/Documents/versioned/freight/test/tmp/freight/var/cache example InRelease
     The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D355AF455A77948D
   Reading package lists...
   W: GPG error: file:/home/user/Documents/versioned/freight/test/tmp/freight/var/cache example InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY D355AF455A77948D
   E: The repository 'file:/home/user/Documents/versioned/freight/test/tmp/freight/var/cache example InRelease' is not signed.
   E: flAbsPath on ./test/tmp/apt/var/lib/dpkg/status failed - realpath (2: No such file or directory)
   E: Could not open file  - open (2: No such file or directory)
   E: Problem opening
   E: The package lists or status file could not be parsed or opened.

@mmoll how are those tests supposed to run unattended as one has to type the password in? Do the CI tests still run on each PR? Because my PR (#100) didn't trigger any?

yegorich commented 3 years ago

@mmoll so far, I could fix all test issues so that all tests pass locally. See #109 and #110. Could you please take a look at them? I need these PRs in order to work on GitHub Actions transition.

The way to go is to create a key inside the GitHub repo settings (see this answer). My biggest concern for now is how to handle interactive password requests, especially in apt.

yegorich commented 3 years ago

Solved via #109 and #110.