Weird behaviour: arbitrary and random REVERT while running test with same code without any changes #2092
Comments
Hey @itinance, based on your repo's activity, looks like you're already on it, but I would def make sure that for all contract instance method calls you make sure to |
Thx for reaching out @CruzMolina. I've already found missing
5 times "truffle test" in a row, grepped for "Error:", 4 failed:
15 tests in a row, 5 failed:
5 fails in 15 runs. But the count is arbitrary and may differ in subsequent tests. It is remarkable that only the CrowdSale-Test with minting token makes this trouble. Indeed, when I don't call Nothing special happens there:
|
Are your tests still failing on the |
@CruzMolina yes I switched completely into MintableCrowdsale of OpenZeppelin-eth from my own implementation and the same issues occur from time to time |
Ah, so sometimes the Perhaps it wouldn't hurt to subtract one second from |
Hey @CruzMolina , you are right! It is the time function. When I change
to
everything works as expected! I have borrowed this line from OpenZeppelin and will open a PullRequest. THANK YOU VERY MUCH!!!!!!! |
Issue
I get random and unpredictable reverts while running tests on the very same code basis. Sometimes they run through, sometimes a revert is happening running on local network powered by ganache.
When it reverts, in my case it always revert at the line where “addMinter” is executed on the CrowdSale-Contract out of “beforeEach” in the test (which can be seen with the output of
console.log(5).
After “5
” was printed to stdout, it reverts. When I would debug this with“truffle debug $transactionID”
, everything would go through successfully.When I run my tests 5 times, then there is a big chance that at least for one time it reverts with the very first test, sometimes at the second or third test, sometimes everything is going through without any revert.
When I run these tests 10 times, in some cases everything works fine, and mostly it breaks within a particular test like described above.
Sometimes 5 times running tests in a row works sucessfully, sometimes it breaks constantely.
Steps to Reproduce
My tests looks as follows (and can be found here: https://github.com/itinance/ncd-token):
I run on MacbookPro with MacOS Mojave and the following toolset:
Ganache was launched this way:
ganache-cli --mnemonic “your twelve word mnemonic here”
truffle-config.js:
Expected Behavior
Constant predictable behaviour across running tests on the very same code base.
Actual Results
Some times tests are running through, sometimes not
Environment
I run on MacbookPro with MacOS Mojave and the following toolset:
Ganache was launched this way:
ganache-cli --mnemonic “your twelve word mnemonic here”
truffle-config.js:
The text was updated successfully, but these errors were encountered: