This repository has been archived by the owner on Apr 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 51
test: add smoke test for app sample #663
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,24 @@ | ||
{ | ||
"name": "nodejs-docs-samples-debugger", | ||
"description": "Sample for Google Stackdriver Trace on Google App Engine Flexible Environment.", | ||
"version": "0.0.1", | ||
"private": true, | ||
"license": "Apache-2.0", | ||
"author": "Google Inc.", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/GoogleCloudPlatform/nodejs-docs-samples.git" | ||
}, | ||
"author": "Google LLC", | ||
"repository": "googleapis/cloud-debug-nodejs", | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"scripts": { | ||
"deploy": "gcloud app deploy", | ||
"start": "node app.js", | ||
"system-test": "repo-tools test app", | ||
"test": "npm run system-test", | ||
"e2e-test": "repo-tools test deploy" | ||
"test": "mocha" | ||
}, | ||
"dependencies": { | ||
"@google-cloud/debug-agent": "^3.1.0", | ||
"express": "4.16.4" | ||
}, | ||
"devDependencies": { | ||
"@google-cloud/nodejs-repo-tools": "^3.0.0", | ||
"execa": "^1.0.0", | ||
"mocha": "^6.0.0" | ||
}, | ||
"cloud-repo-tools": { | ||
"test": { | ||
"app": { | ||
"msg": "Hello, world!" | ||
} | ||
}, | ||
"requiresKeyFile": true, | ||
"requiresProjectId": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright 2019, Google, LLC. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const execa = require('execa'); | ||
|
||
describe('debug samples', () => { | ||
|
||
it('should run the quickstart', done => { | ||
// select a random port between 49152 and 65535 | ||
const PORT = Math.floor((Math.random() * (65535-49152))) + 49152; | ||
const proc = execa('node', ['app.js'], { | ||
env: { | ||
PORT | ||
} | ||
}); | ||
proc.stdout.on('data', message => { | ||
// Listen to stdout and look for messages. If we get a `Press CTRL+...` | ||
// assume the process started. Wait a second to make sure there | ||
// is no stderr output signifying something may have gone wrong. | ||
message = message.toString('utf8'); | ||
if (/Press Ctrl/.test(message)) { | ||
setTimeout(() => { | ||
proc.kill(); | ||
done(); | ||
}, 1000); | ||
} | ||
}) | ||
proc.stderr.on('data', message => { | ||
// if anything comes through stderr, assume a bug | ||
done(new Error(message.toString('utf8'))); | ||
}); | ||
}); | ||
|
||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a difference in style, I'd usually just pick a port and use it consistently for integration tests (I'd rather know that I'm not shutting down cleanly via failure to bind).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In retrospect, that's probably going to be fine too. Initially I was worried about the same tests running in parallel, but it doesn't matter since they're almost always in docker containers that should abstract it from us.