Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ddq-backend-tests

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ddq-backend-tests

Tests for DDQ backend plugins.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 27 Jan 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc