Comments (13)
No, that's not related to the issue with the re-loading.
from clockwork-test.
I'm not sure how this is an issue with the repo if the problem is in your clock file. Could you clarify how this is manifesting as a result of this test library?
from clockwork-test.
Hey @kevin-j-m! First of all, many thanks for the gem and for responding. :)
The gem does try to require the clock configuration file I assume, and for the five test cases we have, it does so five times. Everything after the first re-requires the module and its constants I believe?
from clockwork-test.
Are you running Clockwork::Test.clear!
before/after every run? Every time run
is invoked, it will load the clock file. I would guess if you have multiple runs without a clear, then this will load the file multiple times, which I'd guess would raise that warning.
from clockwork-test.
Yes, the load would be the problem here. Ruby's require
requires only once. Maybe the result of the load ought to be memoized in some way?
from clockwork-test.
Are you clearing the manager between all of your 5 test runs? You're going to want to do that anyway to lose the job history between runs - but I believe will also resolve your issues of calling run
multiple times with a given manager.
from clockwork-test.
How do I clear it? I can try it, but the load would still happen within the same Ruby runtime, right - not solving the multiple load?
from clockwork-test.
Clockwork::Test.clear!
gives you a new instance of the manager to call run
against.
from clockwork-test.
Did that help you out?
from clockwork-test.
Thanks for responding. I apologize for not fully understanding the issue until taking another look at it today. I have a branch with a reproduction, where the commit message explains what is happening.
Note that I believe this is another manifestation of the problems in #1. I believe that resolving that would handle this issue as well. I would like to close this in favor of tracking a single issue with the same symptoms (though I'll reference this in there). Sound good?
I welcome contributions to help resolve this.
from clockwork-test.
I looked into it and the way the test library monkey patches clockwork makes me wonder if it isn't wiser to build hooks into clockwork itself.
Another issue: I haven't looked into how the time gem is used, but it does interfere with e.g. the Google gems:
"Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values and use a clock with skew to account for clock differences between systems."
I'll try to look into it during the week or weekend.
from clockwork-test.
Clockwork::Test
does use Timecop
to change time if you specify what you want the time to be. However, it also returns it at the conclusion of a run.
Any issue with time traveling seems unrelated to this initial report. And I would use clockwork tests exclusively to validate the correctness/accuracy of your clock file. I wouldn't additionally perform any functionality testing in there.
I'm going to close this issue in favor of tracking with #1.
from clockwork-test.
It's related in the sense that Clockwork::Test
alters core libraries such as Time
leading to additional failures because there are side effects, e.g. clock skew. I am not testing additional functionality in our clock tests. It's hard to reproduce because it depends on the order of tests and what tests also depend on an accurate time measurement, but for now, I'd say that there probably need to be hooks in the original gem rather than monkeypatching it like this.
from clockwork-test.
Related Issues (15)
- Load up test events by reading file HOT 3
- Test handler as well as schedule HOT 1
- Speed up runs to progress through time faster than actual duration HOT 1
- Support for Database Events HOT 7
- clockwork 2.0.1 breaks clockwork-test HOT 7
- Clockwork::DatabaseEvents HOT 1
- Test against latest ruby point versions
- Test against ruby 2.5 HOT 2
- Forces `config/clock.rb` HOT 2
- Testing 2 clock instances HOT 3
- Migrating from Timecop to ActiveSupport time travel HOT 4
- Release new version HOT 1
- Wildcards for times not supported? HOT 7
- times_run doesn't count when using at: option HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clockwork-test.