npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mock-riak

v0.8.9

Published

A mock library that simulates a running Riak cluster (without actually having one)

Downloads

4

Readme

Riak-mock: A pretend Riak server for your testing pleasure

Riak-mock is a Node.js module that mimics a real-life Riak server cluster that can be initialized, started, and stopped at will. Its goal is to provide developers with a reasonable approximation of the real thing to facilitate testing operations without having to depend on the availability of a real cluster.

Usage as a module

var Riak = require('../index');

var server = new Riak(8087);

server.start();

This will start a new server on port 8087 and attach it to all available IPs. The full signature of the server constructor is:

new Riak(port, [hostname], [log]);

Here, log is a bunyan logging facility that is optionally passed to Riak-mock's underlying restify object.

You can start([callback]) and stop([callback]) the server as needed. Every time a new server is created, it starts with a blank data store that you can populate as needed.

Usage as a server

You can also run Riak-mock as a standalone server; this can be handy when you're trying to track down a particular issue and don't want to create a full environment to deal with the problem. You can do so by installing the module standalone in a location of your choice, and then running npm start, which executes the server.js file. The server includes a built-in logging facility that dumps to stdout.

Limitations

  • It should go without saying—but I'll say it anyway—that Riak-mock is not intended to be a replacement for Riak. Not only does it not support any of the features that make Riak great, like for clustering, load balancing, fault tolerance, and so on; it is also not optimized for standalone, single-server use at all. Its goal is simply to approximate a running instance of Riak to make writing unit tests easier.
  • There are likely to be many subtle differences between the way Riak and Mock-Riak work. The long-term goal is to track those down and fix them, but caveat emptor.
  • Only JavaScript map/reduce jobs are supported.
  • Overall, this project is very young; if your Riak usage goes beyond the basics, you're likely to encounter problems (in which case, bug reports—and, especially, patches—are welcome).

Submitting patches and helping out

You are encouraged to submit patches for the bugs you find. However, you must also provide at least one unit test to cover the patch (unless, of course, the patch is either not code-related or is, itself, a unit test). I will not merge pull requests without covering unit tests, and it's a fair bet that I won't have the time to write the tests myself.

Also, if you want to help out, the project needs much better test coverage, especially when it comes to map/reduce operations, which are a little sketchy at the moment.