GithubHelp home page GithubHelp logo

divmain / drydock Goto Github PK

View Code? Open in Web Editor NEW
21.0 21.0 11.0 740 KB

A stateful, configurable mock server built for predictable end-to-end testing and offline UI development.

License: MIT License

JavaScript 92.76% HTML 2.14% CSS 5.10%

drydock's People

Contributors

divmain avatar dr-nafanya avatar geekdave avatar kurtharriger avatar maciek416 avatar mpfilbin avatar patrickkettner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

drydock's Issues

Allow for case insensitive routes

Is there a reason for why Drydock does not support case insensitive routes? Would you be open to add support for case insensitive routes?

We are using Drydock for one of our testing strategies and are very happy with it. Adding support for case insensitive routes is necessary for us, and we are already using a fork of the project where we can do so. However, we don't want to put ourselves in a situation where it's impossible to drop our fork and use the main version.

Unable to Setup Routes with Overlapping Paths

I'm attempting to mock an api that has endpoints with overlapping paths. For example one endpoint will have a path of "/a/b/c" and another will have a path of "a/b/c/d". When I try to run the drydock file I receive an error of "New route conflicts with existing". Is there a way around this, is this simply not supported by drydock, or is this a true issue?

Update to latest version of hapi

We are attempting to start multiple instances of drydock in webdriverIO so that tests can be run in parallel and encountered an issue with hapi.

Since the port needs to be unique we attempted to use port scanning to find a free port and then start drydock, but since the tests run in parallel we encountered the race condition that the both processes selected the same free port, but one of the processes would still error with EADDRINUSE. I would have expected this error to be passed to the start callback, but appearantly there is a bug in hapi hapijs/hapi#2561.

This bug has already been fixed in latest hapi version, but is not in version 6.x used by drydock. I tried a simple update to package, but it appear the HAPI api has changed a bit.

Would you accept a PR that updates the HAPI version?

npm artifact does not match source

npmjs.org artifact states version 0.7.0 was published 2 months ago, with git head e4dbfdf14d41ecbc85535fdc52c0cf18c401b033 which is not the latest master updated 2 days ago.

Could you bump the to version 0.8.0 and republish?

Forward route mechanism

Define a route that will be automatically forwarded to an endpoint at a different URL. This can be used as a placeholder, where a route you intend to mock can still work (using the real service), or may be used indefinitely in some cases.

starting frontend app

Can I use drydock to start and stop the frontend for my app for frontend testing or is that not advised?
In principle all that would have to be done is npm start and npm stop.
It would integrate nicely into something like boilerplate-nightwatch.

Proxy does not support SSL

Modifying the example slightly to use https instead of http fails:

import Drydock from 'drydock';
const drydock = new Drydock();
drydock.proxyRoute({
  method: "GET",
  path: "/google",
  forwardTo: "https://www.google.com/"
});
drydock.start();

response:

{
statusCode: 500,
error: "Internal Server Error",
message: "An internal server error occurred"
}

console:

debug: hapi, internal, implementation, error
    TypeError: Uncaught error: Cannot read property 'statusCode' of undefined
    at Request._callback (/Users/pairing/projects/churro/taco/node_modules/drydock/lib/node/routes/instance.js:179:32)
    at self.callback (/Users/pairing/projects/churro/taco/node_modules/request/request.js:200:22)
    at emitOne (events.js:90:13)
    at Request.emit (events.js:182:7)
    at Request.onRequestError (/Users/pairing/projects/churro/taco/node_modules/request/request.js:831:8)
    at emitOne (events.js:90:13)
    at ClientRequest.emit (events.js:182:7)
    at TLSSocket.socketErrorListener (_http_client.js:306:9)
    at emitOne (events.js:90:13)
    at TLSSocket.emit (events.js:182:7)
    at emitErrorNT (net.js:1249:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

The root cause gets swallowed by checking statusCode in the callback before checking the err, but quick hack to add console.log around the err we find the root cause is actually:

Error: Hostname/IP doesn't match certificate's altnames: "Host: localhost. is not in the cert's altnames: DNS:www.google.com"]
  reason: 'Host: localhost. is not in the cert\'s altnames: DNS:www.google.com'

This is a result of also forwarding the "Host: " header.
We found if we delete host.headeror set it explicitly the request succeeds.

Anything we are missing here? Should we determine host from the forwardTo?

Proxy all undefined routes

If a URL is requested that is not defined as a mock route (or the control panel route), forward that request along to the intended endpoint. This assumes that the client has been configured to use the mock IP and port as a proxy.

Proxy entire prefix

It would be useful to proxy an entire url prefix to another server.

    drydock.proxyRoute({
        method: "GET",
        path: "/something/*",
        forwardTo: "https:/host/something/"
      });

I think we need to currently proxy each route explicitly.

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.