Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit f5ca162

Browse files
committed
Created consumer and producer to run in parallel to test elasticsearch
1 parent bbeb76e commit f5ca162

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: MIT-0
3+
const elasticsearch = require('elasticsearch');
4+
const awsElasticSearch = require('http-aws-es');
5+
const ChanceJs = require('chance');
6+
const chance = new ChanceJs();
7+
8+
describe('Elasticsearch Document Consumer', () => {
9+
10+
const elasticSearchUrl = 'https://banana.us-west-2.es.amazonaws.com';
11+
const index = 'performance-testing';
12+
const client = new elasticsearch.Client({
13+
hosts: [elasticSearchUrl],
14+
connectionClass: awsElasticSearch,
15+
apiVersion: "6.3",
16+
});
17+
18+
it('searches documents based on random text', () => {
19+
return client.search({
20+
index: index,
21+
q: chance.word(),
22+
});
23+
});
24+
});

examples/elasticsearch/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "elasticsearch-test-suite",
33
"version": "1.0.0",
44
"description": "Example of load testing an Amazon Elasticsearch cluster",
5-
"main": "index.test.js",
5+
"main": "producer.test.js",
66
"dependencies": {
77
"aws-sdk": "^2.348.0",
88
"chance": "^1.0.16",
@@ -12,7 +12,7 @@
1212
},
1313
"devDependencies": {},
1414
"scripts": {
15-
"test": "mocha index.test.js"
15+
"test": "mocha producer.test.js"
1616
},
1717
"author": "Fernando Dingler",
1818
"license": "MIT-0",

examples/elasticsearch/index.test.js renamed to examples/elasticsearch/producer.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Copyright <YEAR> Amazon.com, Inc. or its affiliates. All Rights Reserved.
1+
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: MIT-0
33
const elasticsearch = require('elasticsearch');
44
const awsElasticSearch = require('http-aws-es');
55
const ChanceJs = require('chance');
66
const chance = new ChanceJs();
77

8-
describe('Elasticsearch GameDay', () => {
8+
describe('Elasticsearch Document Producer', () => {
99

1010
const elasticSearchUrl = 'https://banana.us-west-2.es.amazonaws.com';
1111
const index = 'performance-testing';

examples/elasticsearch/taurus.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ execution:
1616
- executor: mocha
1717
hold-for: 1m
1818
scenario:
19-
script: index.test.js
19+
script: producer.test.js
20+
- executor: mocha
21+
hold-for: 1m
22+
scenario:
23+
script: consumer.test.js
2024

2125
services:
2226
- module: shellexec

0 commit comments

Comments
 (0)