GithubHelp home page GithubHelp logo

Start programatically about ldap-server-mock HOT 15 CLOSED

cope avatar cope commented on September 26, 2024
Start programatically

from ldap-server-mock.

Comments (15)

maxime-beguin avatar maxime-beguin commented on September 26, 2024 2

Hi @dominic-p, hi @cope, hi @royetadmor,

This feature has been implemented on the develop branch and will be available in version 6.0.0 soon.

Thank you for your support.

from ldap-server-mock.

dominic-p avatar dominic-p commented on September 26, 2024 1

I'm interested in using this for testing as well. I think it would really benefit from a Node.js API instead of having to deal with child_process.

I could submit a PR if that would be helpful. I'm thinking just add a main entry to package.json pointing to a new file that exports a "createSearver" function that you can call and pass in your config and db objects.

Thanks for the fantastic software, by the way.

from ldap-server-mock.

maxime-beguin avatar maxime-beguin commented on September 26, 2024

Hi @cope,

Yes you can use NodeJs Child process to start the LDAP server mock from your tests.
The LDAP server mock will emit {status: 'started'} on parent process when it is ready.

Hope it helps.

from ldap-server-mock.

cope avatar cope commented on September 26, 2024

Awesome, will try it now!

from ldap-server-mock.

cope avatar cope commented on September 26, 2024

Hi @maxime-beguin, can we also set groups in database, in addition to users?

from ldap-server-mock.

cope avatar cope commented on September 26, 2024

I keep getting ENOENT with spawn 😞

Both npx ldap-server-mock --conf=... and ldap-server-mock --conf=... work from command line, but throw ENOENT with spawn 😞

from ldap-server-mock.

cope avatar cope commented on September 26, 2024

Hmmm, even npx -h throws ENOENT with spawn 😞

from ldap-server-mock.

cope avatar cope commented on September 26, 2024

The best I can get is mocha timeout and left over node processes I then have to kill 😞

Is there a working example with spawn, to look at?

from ldap-server-mock.

maxime-beguin avatar maxime-beguin commented on September 26, 2024

Hi @cope!

Have you tried forking using directly node instead of npx?

from ldap-server-mock.

cope avatar cope commented on September 26, 2024

No, but to be fair, exporting a module like LdapMockServer to be used in testing suites with start() and stop() would be way better...

from ldap-server-mock.

maxime-beguin avatar maxime-beguin commented on September 26, 2024

I agree. It would probably be more easy to use in some cases.
Maybe in a future version.

from ldap-server-mock.

royetadmor avatar royetadmor commented on September 26, 2024

@cope I had the same issue (starting and closing the server for testing purposes) and I can suggest this workaround:
Start the server: npx ldap-server-mock --conf=./ldap_server_config.json --database=./ldap_user_data.json & (the & is for running the server in the background)
Close the server: pgrep -f ldap-server-mock | xargs kill -9
Hope this helps! 😄

from ldap-server-mock.

maxime-beguin avatar maxime-beguin commented on September 26, 2024

HI @dominic-p,

Thank you for your support, sadly I currently don't have much time to work on this project.
I should be able to work on this during november.

You can of course submit a pull request but I won't be able to address it until november.
As you probably aslo have things to do on your side, I suggest you to wait until november.

Thanks again.

from ldap-server-mock.

dominic-p avatar dominic-p commented on September 26, 2024

Thanks for the feedback, and I totally understand. If I have some time to work on a PR I will, otherwise I'll wait on this for the time being.

from ldap-server-mock.

dominic-p avatar dominic-p commented on September 26, 2024

So cool! Thanks for that. :)

from ldap-server-mock.

Related Issues (14)

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.