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

go client is not fooled by faketime #263

Closed
jku opened this issue Feb 9, 2025 · 3 comments · Fixed by #265
Closed

go client is not fooled by faketime #263

jku opened this issue Feb 9, 2025 · 3 comments · Fixed by #265

Comments

@jku
Copy link
Member

jku commented Feb 9, 2025

There are a few tests that require faketime in the suite.

  • test suite uses faketime to run clients-under-test at different times. faketime uses LD_PRELOAD tricks to intercept some system calls
  • golang does not use those system calls

So the results from faketime tests are incorrect for go

TODO:

  • fix the golang test client: maybe the test client could read the (faked) system time with by shelling out a "date +%s" and the library could offer some mechanism to set current date for test purposes?
  • maybe add a test to make sure our time faking works: currently go client looks like it works but we don't actually know
@jku
Copy link
Member Author

jku commented Feb 9, 2025

maybe add a test to make sure our time faking works: currently go client looks like it works but we don't actually know

I will do this bit

@jku
Copy link
Member Author

jku commented Feb 9, 2025

Acoording to go-tuf docs Updater.UnsafeSetRefTime() exists. Possibly we only need to

  • read the reference time using system call to date +%s in clients/go-tuf
  • Use Updater.UnsafeSetRefTime() with that reference time
    `

@jku
Copy link
Member Author

jku commented Feb 9, 2025

Yes, this can be worked arount in the test client: I will fix in #265

@jku jku removed the help wanted Extra attention is needed label Feb 10, 2025
@jku jku linked a pull request Feb 10, 2025 that will close this issue
@jku jku closed this as completed in #265 Feb 11, 2025
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 a pull request may close this issue.

1 participant