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

Make all tests stable #148

Open
AMDmi3 opened this issue Dec 27, 2024 · 0 comments
Open

Make all tests stable #148

AMDmi3 opened this issue Dec 27, 2024 · 0 comments
Labels
Component: webapp repology-webapp, repology web application Effort: complex Depends on huge refactoring or a lot of missing code Priority: someday Normal priority Topic: testing Tests & CI Type: refactoring Internal improvements which do not change behavior

Comments

@AMDmi3
Copy link
Member

AMDmi3 commented Dec 27, 2024

Some snapshot tests are dependent on current time and need to be fixed

  • graphs
  • log
  • link
  • orphaned maintainer
  • orphaned repository
  • orphaned projects

graphs tests are currently ignored as they change frequently, others contain elapsed times in templates, which recently changed from 11 to 12 months (since we use dates from Jan 2024 in test fixtures), will change once again in a month and the will change every year.

To fix these, we'll need to fake current time, probably in both database and the application (however, may consider consolidating it in one place).

  • Database recipe is described here.
  • Application is a bit more complex, and we cannot just use condition compilation, as tests use library compiled normally. Implementing mock time would need a cascade of changes (which we'll need regardless of this issue):
    • Implement global config, pass it to application constructor, pass it through state to endpoints. Pass a flag to enable test time through the config.
    • Automatically and unconditionally construct template context, take a test time flag from the state.
    • Implement now() in template context.
@AMDmi3 AMDmi3 added Component: webapp repology-webapp, repology web application Effort: complex Depends on huge refactoring or a lot of missing code Priority: someday Normal priority Type: refactoring Internal improvements which do not change behavior Topic: testing Tests & CI labels Dec 27, 2024
AMDmi3 added a commit that referenced this issue Dec 28, 2024
The change is caused by updated ages (11 months ago → 12 months ago)

This should be fixed at some point (see #148)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: webapp repology-webapp, repology web application Effort: complex Depends on huge refactoring or a lot of missing code Priority: someday Normal priority Topic: testing Tests & CI Type: refactoring Internal improvements which do not change behavior
Projects
None yet
Development

No branches or pull requests

1 participant