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

Race problem on C++ target #94

Open
darmie opened this issue Jun 19, 2022 · 1 comment
Open

Race problem on C++ target #94

darmie opened this issue Jun 19, 2022 · 1 comment

Comments

@darmie
Copy link

darmie commented Jun 19, 2022

Some it functions aren't executed linearly, they seem to run in parallel. How do I fix? afterEach didn't fix it

Example

it('should emit a removeInitial event', (done) -> {
	g.once('removeInitial', (iips) -> {
		final iip:zenflo.graph.GraphIIP = iips[0];
		iip.from.data.should.be('Foo');
		iip.to.node.should.be('Split');
		iip.to.port.should.be('in');
		done();
	});
	g.removeInitial('Split', 'in');
	trace("should emit a removeInitial event =>" + g.initializers);
});
it('should contain no IIPs', () -> {
	trace("should contain no IIPs =>" + g.initializers.length);
	g.initializers.length.should.be(0);
});

The order at which the output prints are:

should contain no IIPs =>1
should emit a removeInitial event =>[]

Expected outcome:

should emit a removeInitial event =>[]
should contain no IIPs =>1
@ciscoheat
Copy link
Owner

Hi, I can't give you much information at the moment, a bit busy with other things, but if you are able to debug the SuitesRunner.hx you should be able to see if the tests are added and executed in the correct order, at least.

If we keep our fingers crossed that the library code works, check the scope of the variables so the race condition doesn't occur outside the tests. Where g is defined for example.

If that seems ok, since it tests in general should be independent from each other, you could solve the issue by moving the last test into the first one, basically testing just before done is called, instead of a whole new it clause.

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

No branches or pull requests

2 participants