-
Notifications
You must be signed in to change notification settings - Fork 0
test(ci): measure cross-package coverage and add unit tests #157
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
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 |
|---|---|---|
|
|
@@ -823,7 +823,10 @@ tasks: | |
| MIN_COVERAGE: '{{.MIN_COVERAGE | default "72"}}' | ||
| cmds: | ||
| - | | ||
| test -f profile.cov || go test -coverprofile=profile.cov ./cmd/forst/... ./internal/... -count=1 | ||
| if [ ! -f profile.cov ]; then | ||
| PKGS=$(go list ./cmd/forst/... ./internal/... ./nodert/... | paste -sd, -) | ||
| go test -coverprofile=profile.cov -coverpkg="$PKGS" ./cmd/forst/... ./internal/... ./nodert/... -count=1 | ||
| fi | ||
| - bash scripts/check_coverage_threshold.sh profile.cov {{.MIN_COVERAGE}} | ||
|
|
||
| test:go:short: | ||
|
|
@@ -839,7 +842,9 @@ tasks: | |
| deps: [build:node-runtime] | ||
| cmds: | ||
| - task: build:vscode | ||
| - go test -race -covermode atomic -coverprofile=profile.cov -timeout=10m ./cmd/forst/... ./internal/... ./nodert/... | ||
| - | | ||
| PKGS=$(go list ./cmd/forst/... ./internal/... ./nodert/... | paste -sd, -) | ||
| go test -race -covermode atomic -coverpkg="$PKGS" -coverprofile=profile.cov -timeout=10m ./cmd/forst/... ./internal/... ./nodert/... | ||
|
Comment on lines
+845
to
+847
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. 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win Package-list computation for
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
|
|
||
| ci:e2e: | ||
| desc: Run CI E2E suite (runtime examples, node interop, sidecar, providers) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,13 +10,10 @@ import ( | |
|
|
||
| func TestLogBuildInfo_logsVersionCommitDate(t *testing.T) { | ||
| t.Parallel() | ||
| Version = "1.2.3" | ||
| Commit = "abc123" | ||
| Date = "2026-07-08" | ||
| origVersion, origCommit, origDate := BuildInfo() | ||
| SetBuildMetadata("1.2.3", "abc123", "2026-07-08") | ||
| t.Cleanup(func() { | ||
| Version = "dev" | ||
| Commit = "unknown" | ||
| Date = "unknown" | ||
| SetBuildMetadata(origVersion, origCommit, origDate) | ||
|
Comment on lines
+13
to
+16
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. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Remove parallel execution from tests that replace global metadata.
As per coding guidelines, tests must be “precise, reproducing unit or integration tests.” 📍 Affects 1 file
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| }) | ||
|
|
||
| var buf bytes.Buffer | ||
|
|
@@ -35,13 +32,10 @@ func TestLogBuildInfo_logsVersionCommitDate(t *testing.T) { | |
|
|
||
| func TestBuildInfoMap(t *testing.T) { | ||
| t.Parallel() | ||
| Version = "v" | ||
| Commit = "c" | ||
| Date = "d" | ||
| origVersion, origCommit, origDate := BuildInfo() | ||
| SetBuildMetadata("v", "c", "d") | ||
| t.Cleanup(func() { | ||
| Version = "dev" | ||
| Commit = "unknown" | ||
| Date = "unknown" | ||
| SetBuildMetadata(origVersion, origCommit, origDate) | ||
| }) | ||
| m := BuildInfoMap() | ||
| if m["version"] != "v" || m["commit"] != "c" || m["date"] != "d" { | ||
|
|
||
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.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: forst-lang/forst
Length of output: 6412
🌐 Web query:
Taskfile go-task mvdan sh pipefail default shell pipe behavior set errexit💡 Result:
In Task, shell behavior regarding error handling and pipelines is managed through
set:andshopt:directives within the Taskfile [1]. By default, Task does not enableerrexitorpipefailfor commands [1]. Key behaviors and configurations: 1. Pipe Behavior and Pipefail: By default, shell pipelines (e.g.,cmd1 | cmd2) in Task behave like standard POSIX shells, where the exit status of the pipeline is determined by the last command [2]. If you want a pipeline to fail if any command in the sequence fails, you must enablepipefail[1]. This can be configured at the task level or globally by adding it to theset:directive [1]:yaml tasks: my-task: set: [pipefail] cmds: - false | true # This will now cause the task to fail2. Errexit (set -e): Similarly,errexitis not enabled by default. You can enable it via theset:directive (e.g.,set: [errexit]) to ensure the task stops immediately if a command returns a non-zero exit status [1]. Note that Task automatically appliesset -ebehavior to individual commands to prevent issues where multiline string commands might otherwise ignore failures in preceding lines [3]. 3. Scope of Shell Options: - These settings are generally applied tocmd/cmdsexecution [4][1]. - Known limitations exist where theseset:options do not apply to dynamically expanded variables (e.g.,sh:expressions) [5] orstatus:command checks [4]. - If usingshopt:for bash-specific options, ensure they are placed correctly; placingpipefailinshopt:instead ofset:is an error [6][7]. 4. Troubleshooting: If shell options appear not to work, ensure you are using the correct directive (set:for POSIX options likepipefail,errexit,nounset;shopt:for bash-specific options) [1][6]. Task now includes validation that will warn you if you attempt to use an invalid or misplaced option [7]. For complex pipelines that need specific failure handling, you can also explicitly includeset -o pipefailwithin the command string itself [2][8].Citations:
pipefailis not applied tostatuscommands go-task/task#2469set:options don't apply to dynamically (shell) expanded variables go-task/task#1901pipefailis placed inshoptinstead ofsetgo-task/task#2429pipefailfor multiline scripts mvdan/sh#870🏁 Script executed:
Repository: forst-lang/forst
Length of output: 6969
Enable
pipefailfor thego list | pastecommands.check:coveragehas no shell options, andci:testonly declaresset: [errexit]. Since Task pipelines use the last command exit status by default, a failinggo list ./cmd/forst/... ./internal/... ./nodert/...can be masked bypaste;PKGSwould still be accepted and passed to-coverpkg. Addset: [errexit, pipefail]or includeset -o pipefailbefore the command.Also applies to: 845-847
🤖 Prompt for AI Agents