Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup & refactor faketime use #265

Merged
merged 6 commits into from
Feb 11, 2025

Conversation

jku
Copy link
Member

@jku jku commented Feb 9, 2025

I wanted to add sigstore root-signing repository as test data in the test suite but ended up doing this cleanup PR first.

  • Move the "test infra" code into a sub directory: this should make it clearer what the actual tests are
  • refactor faketime setup
    • Use an actual datetime for the reference time argument (instead of "days in future")
    • add a "timestamp" file to static test repositories: a date when the repository is known to be valid. This will be useful because by using this time with faketime, we will be able to add real world repos with short expiry times (see Add sigstore root-signing as static test data #264)
    • Add a test to verify that our faketime setup works
    • Add a workaround in the golang client to make it actually use faketime (Go does not use libc so bypasses faketime without this)

jku added 4 commits February 9, 2025 10:50
This way the main tuf_conformance/ directory contains just tests.

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
"days_in_future" is not really usable in cases where we want to test a
specific date (whereas the relative time is easy to transform to a
datetime.)

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
This will allow adding real world repositories that have short
expiries

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
It does not work with golang.

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
@jku jku marked this pull request as ready for review February 9, 2025 11:04
* test suite uses faketime to set client reference time: this works for
  most clients
* Golang does not use libc so bypasses the tricks that faketime uses:
  faketime does not work for go client
* Add dumb code in the test client to get the current date with "date"
  command: this does use libc so is handled by faketime
* This fixes test_faketime(): remove expected failure

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
@jku jku linked an issue Feb 10, 2025 that may be closed by this pull request
@jku jku requested review from loosebazooka and a team February 11, 2025 10:00
Remove requirement to be a long lived repo

Signed-off-by: Jussi Kukkonen <jkukkonen@google.com>
@jku jku merged commit 1efa2da into theupdateframework:main Feb 11, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go client is not fooled by faketime
2 participants