-
Notifications
You must be signed in to change notification settings - Fork 1
test(desktop): add e2e smoke and wire swift tests into just test #8
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
Merged
Merged
Changes from all commits
Commits
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 hidden or 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 |
|---|---|---|
|
|
@@ -50,3 +50,6 @@ jobs: | |
|
|
||
| - name: Build | ||
| run: just build | ||
|
|
||
| - name: Desktop e2e | ||
| run: just e2e | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,42 @@ | ||
| #!/bin/sh | ||
| # Desktop e2e smoke: 실제 바이너리를 fixture 워크스페이스로 부팅시켜 검증한다. | ||
| # 1) SkimDesktopSmoke가 빈 fixture에 스키마를 만들고 0건을 읽는지 | ||
| # 2) sqlite3로 시드한 포스트 1건을 같은 바이너리가 읽어내는지 | ||
| # 3) SkimDesktop 앱이 fixture 워크스페이스로 부팅해 죽지 않는지 | ||
| set -eu | ||
|
|
||
| ROOT="$(cd "$(dirname "$0")/.." && pwd)" | ||
| BIN="$(swift build --package-path "$ROOT/apps/desktop" --show-bin-path)" | ||
| swift build --package-path "$ROOT/apps/desktop" | ||
|
|
||
| FIXTURE="$(mktemp -d)" | ||
| APP_PID="" | ||
| cleanup() { | ||
| [ -n "$APP_PID" ] && kill "$APP_PID" 2>/dev/null || true | ||
| [ -n "$FIXTURE" ] && /bin/rm -rf -- "$FIXTURE" | ||
| } | ||
| trap cleanup EXIT | ||
|
|
||
| export SKIM_WORKSPACE_ROOT="$FIXTURE" | ||
| mkdir -p "$FIXTURE/data" | ||
|
|
||
| echo "== smoke: empty fixture ==" | ||
| "$BIN/SkimDesktopSmoke" | tee /dev/stderr | grep -q "recent_posts=0" | ||
|
|
||
| echo "== seed one post ==" | ||
| sqlite3 "$FIXTURE/data/skim.db" "INSERT INTO posts (platform, external_id, author, title, content, content_markdown, url, timestamp) | ||
| VALUES ('hackernews', 'e2e-1', 'e2e', 'E2E fixture post', 'body', '# E2E fixture post', 'https://example.com', datetime('now'));" | ||
|
|
||
| echo "== smoke: seeded fixture ==" | ||
| "$BIN/SkimDesktopSmoke" | tee /dev/stderr | grep -q "recent_posts=1" | ||
|
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. |
||
|
|
||
| echo "== app boot ==" | ||
| "$BIN/SkimDesktop" & | ||
| APP_PID=$! | ||
| sleep 5 | ||
| kill -0 "$APP_PID" || { echo "FAIL: SkimDesktop exited within 5s"; exit 1; } | ||
| kill "$APP_PID" | ||
| wait "$APP_PID" 2>/dev/null || true | ||
| APP_PID="" | ||
|
|
||
| echo "OK: desktop e2e passed" | ||
Oops, something went wrong.
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.
현재 파이프라인(
"$BIN/SkimDesktopSmoke" | tee /dev/stderr | grep -q "recent_posts=0")은set -o pipefail이 설정되어 있지 않아,SkimDesktopSmoke가 실행 중 에러(non-zero exit code)를 내며 크래시가 발생하더라도grep이 성공하면 전체 파이프라인이 성공한 것으로 간주됩니다. 또한grep -q는 매칭되는 즉시 파이프를 닫으므로tee나SkimDesktopSmoke가SIGPIPE로 인해 비정상 종료될 위험이 있습니다.이를 방지하기 위해 출력을 변수에 담아 실행 성공 여부를
set -e로 보장받은 뒤,grep으로 검증하는 방식이 더 안전합니다.