Skip to content

Commit

Permalink
Client side monitoring functional tests (#2316)
Browse files Browse the repository at this point in the history
* add csm functional test

* add support for MaxRetriesExceeded entry
  • Loading branch information
AllanZhengYP committed Oct 22, 2018
1 parent 4d6aa8b commit 3714284
Show file tree
Hide file tree
Showing 11 changed files with 1,373 additions and 3 deletions.
10 changes: 10 additions & 0 deletions lib/service.js
Expand Up @@ -296,6 +296,8 @@ AWS.Service = inherit({
Api: api ? api.name : request.operation,
Version: 1,
Service: request.service.api.serviceId || request.service.api.endpointPrefix,
Region: request.httpRequest.region,
MaxRetriesExceeded: 0
}
},

Expand Down Expand Up @@ -410,6 +412,14 @@ AWS.Service = inherit({
apiCallEvent.Timestamp = callTimestamp;
var latency = Math.round(AWS.util.realClock.now() - callStartRealTime);
apiCallEvent.Latency = latency >= 0 ? latency : 0;
var response = request.response;
if (
typeof response.retryCount === 'number' &&
typeof response.maxRetries === 'number' &&
(response.retryCount >= response.maxRetries)
) {
apiCallEvent.MaxRetriesExceeded = 1
}
self.emit('apiCall', [apiCallEvent]);
})
},
Expand Down
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -140,6 +140,7 @@
"region-check": "node ./scripts/region-checker/index.js",
"translate-api-test": "mocha scripts/lib/translate-api.spec.js",
"typings-generator-test": "mocha scripts/lib/prune-shapes.spec.js",
"helper-test": "mocha scripts/lib/test-helper.spec.js"
"helper-test": "mocha scripts/lib/test-helper.spec.js",
"csm-functional-test": "mocha test/publisher/functional_test"
}
}
1 change: 1 addition & 0 deletions scripts/composite-test.js
Expand Up @@ -16,6 +16,7 @@ async function run() {
{ execute: 'executeLongProcess', command: ['npm', 'run', 'typings-generator-test'] },
{ execute: 'executeLongProcess', command: ['npm', 'run', 'browsertest'] },
{ execute: 'executeLongProcess', command: ['npm', 'run', 'react-native-test'] },
{ execute: 'executeLongProcess', command: ['npm', 'run', 'csm-functional-test'] }
];
for (const { execute, command, execOptions, retryCount } of scripts) {
try {
Expand Down
6 changes: 5 additions & 1 deletion tasks/browser.rake
Expand Up @@ -24,6 +24,10 @@ def sdk_version
JSON.parse(File.read('package.json'))['version']
end

def excluded_files(name)
name.start_with?("test/react-native/") || name.start_with?("test/publisher")
end

namespace :browser do
$BUILDER = "node dist-tools/browser-builder.js"
$BROWSERIFY = "browserify"
Expand Down Expand Up @@ -74,7 +78,7 @@ namespace :browser do
mkdir_p "test/browser/build"
cp "dist/aws-sdk-all.js", "test/browser/build/aws-sdk-all.js"
files = "test/helpers.js ";
files += Dir.glob("test/**/*.spec.js").delete_if{|name| name.start_with?("test/react-native/")}.sort().join(" ")
files += Dir.glob("test/**/*.spec.js").delete_if{|name| excluded_files(name)}.sort().join(" ")
sh({"SERVICES" => "all"}, $BROWSERIFY +
" -i domain #{files} > #{$BROWSERIFY_TEST}")
rm_f "test/configuration.js"
Expand Down
2 changes: 1 addition & 1 deletion tasks/react-native.rake
Expand Up @@ -13,7 +13,7 @@ namespace :reactnative do
mkdir_p "test/browser/build"
cp "dist/aws-sdk-react-native.js", "test/browser/build/aws-sdk-all.js"
files = "test/helpers.js ";
files += Dir.glob("test/**/*.spec.js").sort().join(" ")
files += Dir.glob("test/**/*.spec.js").sort().delete_if{|name| name.start_with?("test/publisher")}.join(" ")
sh({"SERVICES" => "all"}, $BROWSERIFY +
" -i domain #{files} > #{$BROWSERIFY_TEST}")
rm_f "test/configuration.js"
Expand Down

0 comments on commit 3714284

Please sign in to comment.