Comments (9)
@djones8520 I will definitely be taking a look at this. There are certainly some optimizations that can be made to scope. I don't have a solution off the top of my head, but I will look into this shortly.
Thanks for opening the issue :)
from peridot.
So, I found the handy clearProphet function on ProphecyScope and added that function call to any ProphecyScope children on $scope. That allowed the tests to pass locally at 128 MB (was failing). However, they still fail on circleci at the same limit.
Locally, I tested a few different limits and it fails at 127 MB. That seems like a pretty tight window. It got me wondering about the memory needed to run peridot and I didn't see any memory requirements listed. Is 128 not enough memory?
from peridot.
Hmmmm. That is a pretty variable requirement in my opinion. I will definitely acknowledge there could be some improvements to the shared nature of scopes with regard to this problem, but the memory requirement for just about any testing tool increases the larger the test suite. Can I ask how large your test suite is?
from peridot.
If it is a bit on the larger side, this article here seems helpful on bumping up your memory limit for PHP in a circle-ci environment
https://www.neontsunami.com/posts/running-laravel-through-continuous-integration-(ci)-using-circleci
from peridot.
Something to the effect of:
// circle.yml
machine:
php:
version: 5.4.21
dependencies:
pre:
- echo "memory_limit = 1024M" > ~/.phpenv/versions/5.4.21/etc/conf.d/memory.ini
from peridot.
We have about 800 tests at the moment. I'm not sure how that stacks up to the norm, but it doesn't seem too big.
from peridot.
I don't mind bumping up the memory limit of circleci, but we didn't want to raise it just because. If 128 MB is too small for tests, so be it, but if we're using too much memory in our tests for some reason, we'd rather fix that.
from peridot.
I hear you :)
I suspect scopes are too blame. The loader essentially builds a giant tree out of the entire suite, and with 800 tests, you end up with a decent sized tree. Throw a bunch of large scopes on those nodes and the memory requirement goes up. There might be a way to optimize how that scope is shared/set to prevent unnecessary bloat.
You might be able to free up some memory by running your tests concurrently as well. There is a peridot plugin for that you might try - it currently does not support Windows.
I will take a look into general scope optimization, and specifically the ProphecyPlugin
to see if any optimizations can be made there.
Thanks so much for opening this :)
from peridot.
Sure thing. We ended up increasing the memory limit to solve the "issue." It may have been too low in general.
In case anyone is curious about the scope problem, we got a decent solution I think. Above I posted code that we have in our peridot.php config file. Inside the suite.end event, is:
$children = $scope->peridotGetChildScopes(); foreach($children as $child){ if(get_class($child) == ProphecyScope::class) $child->clearProphet(); }
This clears the variables created and prophecy predictions/other by our tests. suite.end event is after each describe section of the test. There is a test.end event, but that didn't work for use, since it seems to run before afterEach sections and we use those sometimes for asserts that each test in the describe share.
This added event didn't cause any issues that we see, so it seems pretty solid. In fact, we discovered a few tests that were passing due to the "scope leak."
from peridot.
Related Issues (20)
- Symfony 3? HOT 6
- Wordpress? HOT 1
- Allow to filter tests by pattern HOT 6
- Tests always reported as passing? HOT 7
- Scenario Provisioning: Thoughts on new feature? HOT 6
- Fix release strategy
- Feature: "Focused" specs
- Multiple reporters HOT 2
- How can I send config to reporter from console HOT 4
- Fix console output under Windows HOT 2
- setDefinitionArguments() claims to return $this, but doesn't HOT 1
- setParent() claims to return mixed|void, should omit @return HOT 2
- ReporterInterface does not include the methods added by HasEventEmitterTrait
- Data providers / parameterized tests HOT 4
- Support in vim-test HOT 2
- Problemas en windows HOT 1
- beforeAll on suite/file level and global beforeAll
- Peridot 2.0 Ideas HOT 7
- Issues with global varables and nested functions HOT 2
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 peridot.