mirror of
https://github.com/getsentry/self-hosted.git
synced 2025-12-08 19:46:14 +00:00
test: integration test for user feedback (#3880)
* test: integration test for user feedback * fix(test): try to set shell to True to use environment variables * chore: debug nodejs sdk output * test: run user feedback test only on feature-complete * test: make javascript file relative * Update _integration-test/nodejs/package.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update _integration-test/test_01_basics.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
9b4f9ea82e
commit
a9a914840f
1
_integration-test/nodejs/.gitignore
vendored
Normal file
1
_integration-test/nodejs/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
||||
12
_integration-test/nodejs/instrument.js
Normal file
12
_integration-test/nodejs/instrument.js
Normal file
@ -0,0 +1,12 @@
|
||||
import * as Sentry from "@sentry/node";
|
||||
|
||||
Sentry.init({
|
||||
dsn: process.env.SENTRY_DSN,
|
||||
sampleRate: 1.0,
|
||||
tracesSampleRate: 1.0,
|
||||
enableLogs: true,
|
||||
profileLifecycle: "manual",
|
||||
sendClientReports: true,
|
||||
sendDefaultPii: true,
|
||||
debug: true,
|
||||
});
|
||||
1010
_integration-test/nodejs/package-lock.json
generated
Normal file
1010
_integration-test/nodejs/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
13
_integration-test/nodejs/package.json
Normal file
13
_integration-test/nodejs/package.json
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "sentry-self-hosted-integration-test-nodejs",
|
||||
"version": "0.0.0",
|
||||
"description": "Scripts to run for features only available on Nodejs SDK",
|
||||
"author": "Sentry <oss@sentry.io>",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"start": "node --import ./instrument.js index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@sentry/node": "^10.5.0"
|
||||
}
|
||||
}
|
||||
11
_integration-test/nodejs/user-feedback.js
Normal file
11
_integration-test/nodejs/user-feedback.js
Normal file
@ -0,0 +1,11 @@
|
||||
import * as Sentry from "@sentry/node";
|
||||
|
||||
Sentry.captureFeedback({
|
||||
message: "I love your startup!",
|
||||
name: "John Doe",
|
||||
email: "john@example.com",
|
||||
url: "https://example.com",
|
||||
});
|
||||
|
||||
|
||||
Sentry.flush(5000);
|
||||
@ -4,6 +4,7 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from functools import lru_cache
|
||||
from typing import Callable
|
||||
@ -407,6 +408,36 @@ def test_receive_transaction_events(client_login):
|
||||
lambda x: len(json.loads(x)["data"]) > 0,
|
||||
)
|
||||
|
||||
@pytest.mark.skipif(os.environ.get("COMPOSE_PROFILES") != "feature-complete", reason="Only run if feature-complete")
|
||||
def test_receive_user_feedback_events(client_login):
|
||||
client, _ = client_login
|
||||
sentry_dsn = get_sentry_dsn(client)
|
||||
|
||||
|
||||
# Execute `node --import instrument.js user-feedback.js` on the `nodejs` directory with the `SENTRY_DSN` env var set
|
||||
env = os.environ.copy()
|
||||
env["SENTRY_DSN"] = sentry_dsn
|
||||
subprocess.run(
|
||||
["node", "--import", "./instrument.js", "./user-feedback.js"],
|
||||
check=True,
|
||||
shell=False,
|
||||
env=env,
|
||||
cwd="_integration-test/nodejs",
|
||||
stdout=sys.stdout,
|
||||
stderr=sys.stderr,
|
||||
timeout=60,
|
||||
)
|
||||
|
||||
poll_for_response(
|
||||
f"{SENTRY_TEST_HOST}/api/0/organizations/sentry/issues/?query=issue.category%3Afeedback",
|
||||
client,
|
||||
lambda x: len(json.loads(x)) > 0,
|
||||
)
|
||||
poll_for_response(
|
||||
f"{SENTRY_TEST_HOST}/api/0/organizations/sentry/events/?dataset=issuePlatform&field=message&field=title&field=timestamp&project=1&statsPeriod=1h",
|
||||
client,
|
||||
lambda x: len(json.loads(x)["data"]) > 0,
|
||||
)
|
||||
|
||||
@pytest.mark.skipif(os.environ.get("COMPOSE_PROFILES") != "feature-complete", reason="Only run if feature-complete")
|
||||
def test_receive_logs_events(client_login):
|
||||
|
||||
11
action.yaml
11
action.yaml
@ -187,6 +187,17 @@ runs:
|
||||
sudo swapon --show
|
||||
free -h
|
||||
|
||||
- name: Setup Nodejs
|
||||
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
||||
with:
|
||||
node-version: "22.x"
|
||||
|
||||
- name: Install Nodejs dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
cd ${{ github.action_path }}/_integration-test/nodejs
|
||||
npm ci
|
||||
|
||||
- name: Integration Test
|
||||
shell: bash
|
||||
env:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user