-
Notifications
You must be signed in to change notification settings - Fork 3
UTAPI-116: Check stderr and fix deprecation warnings #1318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b199d52
debad24
b7b43de
cada2a6
2fb5e55
71df842
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,16 @@ if [ -z "$SETUP_CMD" ]; then | |
| SETUP_CMD="start" | ||
| fi | ||
|
|
||
| UTAPI_INTERVAL_TEST_MODE=$1 npm $SETUP_CMD 2>&1 | tee -a "setup_$2.log" & | ||
| # Redirect stderr to a separate file (without "Killed" to look for warnings / error messages) | ||
| # While still keeping it in terminal | ||
| # ignore punycode warning from [email protected] in utapiV2 tests | ||
|
|
||
| UTAPI_INTERVAL_TEST_MODE=$1 npm $SETUP_CMD \ | ||
| 2> >(grep -v -E "^Killed$|--trace-deprecation|punycode" | tee -a "setup_$2.stderr.log" >&2) \ | ||
| | tee -a "setup_$2.log" & | ||
|
|
||
| bash tests/utils/wait_for_local_port.bash $PORT 40 | ||
| UTAPI_INTERVAL_TEST_MODE=$1 npm run $2 | tee -a "test_$2.log" | ||
|
|
||
| UTAPI_INTERVAL_TEST_MODE=$1 npm run $2 \ | ||
| 2> >(tee -a "test_$2.stderr.log" >&2) \ | ||
| | tee -a "test_$2.log" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,11 @@ on: | |
| required: false | ||
| description: Timeout for ssh connection to worker (minutes) | ||
| default: 30 | ||
|
|
||
| env: | ||
| AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE: '1' | ||
| # NODE_OPTIONS: '--trace-warnings' | ||
|
|
||
| jobs: | ||
| build-ci: | ||
| uses: ./.github/workflows/build-ci.yaml | ||
|
|
@@ -137,6 +142,11 @@ jobs: | |
| - name: ${{ matrix.test.name }} | ||
| run: ${{ matrix.test.command }} | ||
| env: ${{ matrix.test.env }} | ||
| - name: Print stderr logs | ||
| run: grep -H "" *.stderr.log || true | ||
BourgoisMickael marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if: always() | ||
| - name: Error if stderr logs are not empty | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a bit extreme to fail the test? IDK, just a personal feeling, it's useful to have feedback on any new stderr message, maybe we can add a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's the idea to catch immediately a warning, so we are not surprised later. Then if we don't plan on fixing the warning, we can filter it out from the logs (38badb7) A And I'd like to have this in other components as well in long term |
||
| run: if [ -n "$(find . -name '*.stderr.log' -size +0c)" ]; then exit 1; fi | ||
|
|
||
| tests-v2-with-vault: | ||
| needs: | ||
|
|
@@ -242,6 +252,13 @@ jobs: | |
| tmate-server-rsa-fingerprint: ${{ secrets.TMATE_SERVER_RSA_FINGERPRINT }} | ||
| tmate-server-ed25519-fingerprint: ${{ secrets.TMATE_SERVER_ED25519_FINGERPRINT }} | ||
| if: ${{ ( github.event.inputs.debug == true || github.event.inputs.debug == 'true' ) }} | ||
| - name: Print stderr logs | ||
| run: grep -H "" *.stderr.log || true | ||
BourgoisMickael marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if: always() | ||
| - name: Error if stderr logs are not empty | ||
| run: if [ -n "$(find . -name '*.stderr.log' -size +0c)" ]; then exit 1; fi | ||
|
|
||
|
|
||
| tests-v2-without-sensision: | ||
| needs: | ||
| - build-ci | ||
|
|
@@ -358,3 +375,8 @@ jobs: | |
| tmate-server-rsa-fingerprint: ${{ secrets.TMATE_SERVER_RSA_FINGERPRINT }} | ||
| tmate-server-ed25519-fingerprint: ${{ secrets.TMATE_SERVER_ED25519_FINGERPRINT }} | ||
| if: ${{ ( github.event.inputs.debug == true || github.event.inputs.debug == 'true' ) }} | ||
| - name: Print stderr logs | ||
| run: grep -H "" *.stderr.log || true | ||
BourgoisMickael marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if: always() | ||
| - name: Error if stderr logs are not empty | ||
| run: if [ -n "$(find . -name '*.stderr.log' -size +0c)" ]; then exit 1; fi | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /** | ||
| * Promisifies a function. If the function already returns a promise, | ||
| * it returns it as is. Handles both callbacks and promises. | ||
| * | ||
| * @param {Function} originalFn The function to promisify. | ||
| * @returns {Function} A function that returns a promise. | ||
| */ | ||
| module.exports = function flexiblePromisify(originalFn) { | ||
| // Check if the function provides a custom promise-based version. | ||
| // This is the same mechanism Node's util.promisify uses. | ||
| const customPromisified = originalFn[Symbol.for('nodejs.util.promisify.custom')]; | ||
| if (typeof customPromisified === 'function') { | ||
| return customPromisified; | ||
| } | ||
|
|
||
| // Return the new promise-based wrapper function. | ||
| return function flexiblePromisifiedWrapper(...args) { | ||
| const thisCtx = this; | ||
|
|
||
| return new Promise((resolve, reject) => { | ||
| // 1. Callback will be used if `originalFn` is a callback-style function. | ||
| function callback(err, result) { | ||
| if (err) { | ||
| return reject(err); | ||
| } | ||
| return resolve(result); | ||
| } | ||
|
|
||
| // 2. Call the originalFn, with user's args AND our custom callback. | ||
| const potentialPromise = originalFn.apply(thisCtx, [...args, callback]); | ||
|
|
||
| // 3. If originalFn returned a promise, we use its result and ignore the callback. | ||
| if (potentialPromise && typeof potentialPromise.then === 'function') { | ||
| // The function returned a promise. We'll trust it as the source of truth. | ||
| potentialPromise.then(resolve, reject); | ||
| } | ||
|
|
||
| // If the function did NOT return a promise (i.e., it's a standard callback function), | ||
| // then our promise is already wired up to be resolved or rejected by the `callback` we passed in. | ||
| }); | ||
| }; | ||
| }; |
Uh oh!
There was an error while loading. Please reload this page.