Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Asko Soukka
    @datakurre
    mocking = stubbing
    Similar approach should work for testing all functions, but usually requires touching the function to make them accept the mock/stub as an argument.
    What could a stub be for a GatsbyJS helper? E.g. something that simply counts how many times it has been called and then the test assert just checks that it has been called correct amount of times.
    Asko Soukka
    @datakurre
    Meanwhile I did update versions in the master branch. Changes in GatsbyJS required to replace the use of yarn link with manually symlinking the plugin into test project's node_modules. If you face strange issues, a fresh clone should help. They added some GatsbyJS themes related autodiscovery that broke yarn linked plugins, because GatsbyJS auto-discovers iteself from linked plugin's node_modules...
    To summarize:
    • Try unit-testing functions in src/gatsby-node.js in src/tests/gatsby-node.tests.js
    • I will update acceptance tests to test the new code (and that mostly covers integration tests)
    • If you have issues with master due to my changes, try a fresh clone
    I'm sorry that I'm online weird hours now in July. I'm actually on vacation and I'm mostly on keyboard when the rest of my family is already asleep.
    Alok Kumar
    @iFlameing
    @datakurre thanks for explaining everything in so details.

    I'm sorry that I'm online weird hours now in July. I'm actually on vacation and I'm mostly on keyboard when the rest of my family is already asleep.

    That’s absolutely fine :)

    Asko Soukka
    @datakurre

    @iFlameing To make some heavy manual testing of your work:

    Leave "make watch" running and run "make init-backend" to trigger a lot of content updates. Delete all content from Plone and then start again with "make init-backend" to re-create everything.

    Alok Kumar
    @iFlameing
    @datakurre ok! I am trying that right now and update you with the result.
    Asko Soukka
    @datakurre

    I'm once again working on top-level acceptance tests for your work and I'm seeing those random errors that might actually be GatsbyJS issues. I haven't properly reproduced those yet.

    Those might also be issues caused by gatsby-source-plone asynchronously processing multiple conflicting notifications.

    I wonder if we should wrap notification handlers with a lock https://www.npmjs.com/package/async-lock

    @iFlameing Are you familiar with concept of locks (usually familiar from threaded programming)?
    Alok Kumar
    @iFlameing
    @datakurre No, But I will learn
    Asko Soukka
    @datakurre

    @iFlameing Ok. I believe the README of https://www.npmjs.com/package/async-lock explains it well.

    I've never used that package before, but I've neither ever used locks with JavaScript, so that simple the first Google result.

    @iFlameing I believe that currently every "await" within a single handling of ws.onmessage allows NodeJS to switch execution context.

    For example, whenever we are waiting for the results of call to search-endpoint (for example, to update breadcrumbs or navigation), NodeJS is allowed to start processing next ws.onmessage event.

    Alok Kumar
    @iFlameing
    @datakurre I am thinking that it works like this if any async function is running and if we call it again we have to wait for earlier function call to complete. what do you think?
    Asko Soukka
    @datakurre
    This is just a sophisticated guess, but that may lead to unexpected order of updating / deleting / creating GatsbyJS nodes.
    @iFlameing Yes, I believe. So if we would wrap every ws.onmessage-handler code with async-lock "acquire", only one ws.onmessage would be handled at time.
    Alok Kumar
    @iFlameing
    @datakurre I am currently writing a test for breadcrumbs node. I will make a pr tomorrow and start exploring with the async-lock npm and without it.
    Asko Soukka
    @datakurre
    @iFlameing Thanks. Obviously you should finish your current test tasks first, because every new test protects from regression.
    Alok Kumar
    @iFlameing
    @datakurre I am able to complete these test earlier but writing test for makecontentNode takes lot's of time
    I have to read lot's of code and understand it to make the mock data :)
    Asko Soukka
    @datakurre
    No problem. I'm happy that we were able to use a complete GSOC phase for testing.
    Btw, when I get some new acceptance tests merged I will also rename folder "tests/gatsby-starter-default" to just "example".
    Alok Kumar
    @iFlameing
    @datakurre can we name something like demo because It is more suitable and Gatsby community also following this?
    Asko Soukka
    @datakurre
    @iFlameing Ok. I'll name it "demo" then if that's used elsewhere.
    Anything is better than the current :)
    Alok Kumar
    @iFlameing
    @datakurre In the recent release of Gatsby theme, they named most of them as demo .
    Asko Soukka
    @datakurre
    @iFlameing Thanks for following that.
    Alok Kumar
    @iFlameing
    @datakurre I am going to bed because it is around 1:30 am in my timezone. gdnight :)
    Asko Soukka
    @datakurre
    Good night!
    Asko Soukka
    @datakurre

    I have now added some acceptance tests that do "black box testing" that your GSOC additions update gatsby develop when pages are deleted, modified or added.

    Example run starting from line 1222 at output log of https://travis-ci.org/collective/gatsby-source-plone/jobs/561341455

    MVP code is a bit noisy, but hopefully you have time to refactor and cleanup the code in the last part of GSOC once all planned unit tests have been written.
    Tests in question are here but (in my opinion) that test setup is outside the scope of this GSOC https://github.com/collective/gatsby-source-plone/blob/master/demo/test-updates.robot#L58
    It's old-school Makefile/bash-scripting to start everything in parallel and then uses Selenium with Robot Framework (and its JSON REST test library) to call Plone REST API and test the changes in gatsby develop site.
    Alok Kumar
    @iFlameing
    @datakurre ok, I have submitted the 2nd evaluation form :)
    Asko Soukka
    @datakurre
    Me too :)
    And I got my GatsbyJS fix merged gatsbyjs/gatsby#15919
    Alok Kumar
    @iFlameing
    @datakurre That's great. As you provided the feedback I have to implement the separate function for all the WebSocket event. And write the documentation for WebSocket configuration. I think that random call of API is fixed now? which you mention in the feedback :)
    Asko Soukka
    @datakurre
    @iFlameing Yes. The API call order issue was fixed. Thanks.
    Asko Soukka
    @datakurre

    I cannot say, into how small functions you should refactor the code. Something that looks clean and easily understandable. Something you could be proud to say you wrote it.

    After refactoring and updating the documentation (probably the MD-files in docs-folder is enough; updating the Plone site fixture requires use of Plone), it's up to you if you'd like to do some stretch goals (websocket reconnection, logging refactoring, or more) or just try

    or just try to test the new functions.

    @iFlameing I wrote a small update https://community.plone.org/t/gsoc-2019-gatsbyjs-preview-for-plone/8535/8

    Feel free to add about your experience if you want to :)

    Alok Kumar
    @iFlameing
    @datakurre I will write my experience in the last. Just one thing I want to attend the Plone Conf 2019 and give a talk if Plone Community gives me a chance to speak!
    Alok Kumar
    @iFlameing
    @datakurre My college is situated in Jammu and Kashmir region and there is an intelligence report that some militant activity is going in Kashmir so the government might shut down the internet service for one week because Our Independence day is on 15th of August. I might not able to use the Internet these days. I will send the pr for all the feature once if Internet Service will be down if not then I continue posting the pr as I have done it.
    Asko Soukka
    @datakurre
    @iFlameing That’s ok. Thank you for warning about that before hand.
    Asko Soukka
    @datakurre
    @iFlameing How does the rest of the GSOC look for you? Has your internet connection been ok for now?
    I see you have started working on WebSocket re-connection. That would be great to have. My idea is to have "gatsby develop" -servers with this new plugin running as a long-running services and it would be pity if we should remember to restart them every time Plone sites do restart for a reason or another.
    I assume that this is probably the last issue you are able to do and then you should probably focus on wrapping up and collecting all of your pull requests into a report.