Code Monkey home page Code Monkey logo

Comments (3)

eao197 avatar eao197 commented on August 17, 2024

Hi!

I'll take some time to think about your case.

from sobjectizer.

eao197 avatar eao197 commented on August 17, 2024

It looks like the problem is the absence of any test scenario steps in your test case. You just create a parent coop and then run an empty test scenario by calling run_for method. Because the test scenario is empty the work of the test environment will be finished. It's an asynchronous process that is executed in the background and takes some time. But when you call run_for there is another activity on some worker thread: execution of TestAgent's so_evt_start. And that execution is going in parallel with the shutdown operation. That is why you can't register new cooperation and got the exception.

Please note that agents created in testing.environment().introduce_coop() are frozen until run_for is called. There is an explanation: https://github.com/Stiffstream/sobjectizer/wiki/SO-5.7-Experimental-Testing#a-test-case-for-pingerponger

When testing_env_t is used all agents are frozen after the registration if the testing scenario is not started yet. This means that agents are present in the SObjectizer Environment but they can't handle any events (even so_evt_start is not called). It is possible to send a message to a frozen agent, but this message will wait in some event queue while the agent will be unfrozen.

All agents those are registered before a call to run_for will be automatically unfrozen when run_for is called. It means that so_evt_start for Pinger agent will be called only when we call run_for in our scenario.

from sobjectizer.

JorgenPo avatar JorgenPo commented on August 17, 2024

Thanks for your quick reply.
I've added some test scenario steps and the problem is gone in this simplified test case. In my original test code I had several test steps but it seems like that was a problem with some of these steps and as a result the mentioned exception occurred.
Thanks for the solution and explanations!

from sobjectizer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.