What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

πŸ‘‹ is it possible to substitute the rabbit mq transport with an in-memory transport for testing?

UKGT7RC7P
UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

πŸ‘‹ is it possible to substitute the rabbit mq transport with an in-memory transport for testing?

Comments

  • UKHD8KTMF
    UKHD8KTMF Posts: 393 πŸ§‘πŸ»β€πŸš€ - Cadet

    as long as it implements AMQP should be possible.

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    the end goal would be to process all event synchronously

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    maybe this isn't the best way to approach (replacing the transport)

  • You could have some problems related to the execution environment of the various PHP workers, especially if you couple them all into the same execution for a test.

  • Do you want to test that records are arriving in Redis? What's the focus of your test?

  • E2E testing with an infrastructural replacement might give you incorrect results.

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited November 2019

    idea would be to test the whole lifecycle in-process, mainly for development purposes

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    so you persist the entity, it's published to e/s + redis

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    or similar -- not sure

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    previously we have been triggering events in integration tests and launching worker processes from the test, but it's slow

  • I don't know of anyone who's tried it, and I suspect there will be some technical problems to overcome before you can make it work.

  • It's a cool goal but I think this will be a lot of work.

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited November 2019

    I think we previously actually tried running the workers in-process, which would accomplish testing goals, but there were issues there, but maybe they could be fixed (can't remember now)

  • Is the main pain point for you speed, or are you searching to fix some other issues too?

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited November 2019

    speed - and easier debugging/discovery when developing features via tests (i.e. not debugging across processes)

  • I still don't have a solution for you here, but I can bring this up more when discussing this internally.

    It's probably not the user-experience you want, but I've used tcpdump in the past when I had to debug really complex Spryker things that make network calls.

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet

    also running in a single process means you can run the test in a transaction

  • This is an interesting point, the design is eventually consistent instead of transactional (for various reasons).

  • UKGT7RC7P
    UKGT7RC7P Posts: 538 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited November 2019

    yeah, running the test in a transaction is just a cheap way to help ensure that the test doesn't leak database state

  • Agreed, there's some interesting upsides to it

  • If you log this in our support portal it can become a feature request our product owners can see.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    In this case not a support portal should be used but https://spryker.ideas.aha.io/ideas/new