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

Commit 5a12146

Browse files
committed
Made elasticsearch URL an environment variable passed to the Fargate docker containers. Also restructured elasticsearch directory.
1 parent f5ca162 commit 5a12146

File tree

5 files changed

+81
-31
lines changed

5 files changed

+81
-31
lines changed

bin/runner.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
import uuid
1717

1818

19+
# Will be passed as environment variable to the Fargate docker containers.
20+
# Useful with the Elasticsearch example as the test suite will read the cluster URL from this variable.
21+
ENDPOINT_UNDER_TEST = 'http://strawberry.banana.com'
22+
1923
# List of regions where we have deployed the CloudFormation stack
2024
regions = [
2125
{
@@ -70,6 +74,18 @@ def start_distributed_load_test():
7074
startedBy=run_id,
7175
group=run_id,
7276
launchType='FARGATE',
77+
overrides={
78+
'containerOverrides': [
79+
{
80+
'environment': [
81+
{
82+
'name': 'ENDPOINT_UNDER_TEST',
83+
'value': ENDPOINT_UNDER_TEST
84+
},
85+
],
86+
},
87+
]
88+
},
7389
networkConfiguration={
7490
'awsvpcConfiguration': {
7591
'assignPublicIp': 'ENABLED',

examples/elasticsearch/consumer.test.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
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');
1+
/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
*
3+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
* software and associated documentation files (the "Software"), to deal in the Software
5+
* without restriction, including without limitation the rights to use, copy, modify,
6+
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7+
* permit persons to whom the Software is furnished to do so.
8+
*
9+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
10+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
11+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
12+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
*/
16+
const elasticsearch = require('./es-client');
517
const ChanceJs = require('chance');
618
const chance = new ChanceJs();
719

820
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-
1821
it('searches documents based on random text', () => {
19-
return client.search({
20-
index: index,
22+
return elasticsearch.client.search({
23+
index: elasticsearch.index,
2124
q: chance.word(),
2225
});
2326
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
*
3+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
* software and associated documentation files (the "Software"), to deal in the Software
5+
* without restriction, including without limitation the rights to use, copy, modify,
6+
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7+
* permit persons to whom the Software is furnished to do so.
8+
*
9+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
10+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
11+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
12+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
*/
16+
const elasticsearch = require('elasticsearch');
17+
const awsElasticSearch = require('http-aws-es');
18+
19+
const elasticSearchUrl = process.env.ENDPOINT_UNDER_TEST;
20+
const index = 'performance-testing';
21+
const client = new elasticsearch.Client({
22+
hosts: [elasticSearchUrl],
23+
connectionClass: awsElasticSearch,
24+
apiVersion: "6.3",
25+
});
26+
27+
module.exports.index = index;
28+
module.exports.client = client;

examples/elasticsearch/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"devDependencies": {},
1414
"scripts": {
15-
"test": "mocha producer.test.js"
15+
"test": "mocha ."
1616
},
1717
"author": "Fernando Dingler",
1818
"license": "MIT-0",

examples/elasticsearch/producer.test.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
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');
1+
/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
*
3+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
4+
* software and associated documentation files (the "Software"), to deal in the Software
5+
* without restriction, including without limitation the rights to use, copy, modify,
6+
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
7+
* permit persons to whom the Software is furnished to do so.
8+
*
9+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
10+
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
11+
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
12+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
13+
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
14+
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15+
*/
516
const ChanceJs = require('chance');
17+
const elasticsearch = require('./es-client');
618
const chance = new ChanceJs();
719

820
describe('Elasticsearch Document Producer', () => {
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-
1821
it('stores a JSON document', () => {
19-
return client.index({
20-
index: index,
22+
return elasticsearch.client.index({
23+
index: elasticsearch.index,
2124
type: 'dummyType',
2225
id: chance.hash(),
2326
body: {

0 commit comments

Comments
 (0)