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

ddq-backend-tests

v2.0.0

Published

Tests for DDQ backend plugins.

Downloads

2

Readme

DDQ Backend Functional Tests

npm version Build Status Dependencies Dev Dependencies

Contains functional tests meant to be used by DDQ backend plugins. One example is DDQ MySQL Plugin.

Tests

  • ddqBackendTests.tests.deduplicationTest ensures when a duplicate message is sent, it is not inserted and the original message is "requeued" and processed again.

  • ddqBackendTests.tests.mutlipleListenerTest sets up multiple listeners and makes certain messages are not emitted to both listeners. It then requeues the message from the listener to first process the message, the second processor of the message then removes it.

  • ddqBackendTests.tests.wrappedMessageTest is the more basic of these tests. It tests requeue, heartbeat, and remove. After heartbeat it ensures the heartbeat lifetime elapsed before the message is removed.

Usage

Add this package under devDependencies and use the module to run solitary tests or all at once.

var BackendTester, exit, tester;

exit = process.exit;
BackendTester = require("ddq-backend-tests")();
tester = new BackendTester();
tester.runAllTests((testErr) => {
    if (testErr) {
        console.error("Error occurred running DDQ backend functional tests.");

        throw testErr;
    }

    console.log("Successfully ran backend plugin functional tests");
    exit(0);
});

// For a single test.
tester.tests.wrappedMessageTest(() => {});

The test queue must be setup prior to running these tests. We wrote one plugin in MySQL and here is how we setup our test queue.

DROP DATABASE IF EXISTS testQueue;
CREATE DATABASE testQueue;
USE testQueue;
CREATE TABLE queue (
    hash CHAR(64),
    PRIMARY KEY(hash),
    message VARCHAR(120) NOT NULL,
    requeued BOOLEAN DEFAULT FALSE,
    heartbeatDate DATETIME,
    owner VARCHAR(256),
    isProcessing BOOLEAN DEFAULT FALSE,
    INDEX isProcessing(isProcessing),
    topic VARCHAR(256),
    messageBase64 VARCHAR(256)
);

The configuration that is used for functional tests can be found here.