Skip to content

Commit 9f15e90

Browse files
committed
Add integration test for new diagnostic
1 parent c597a7a commit 9f15e90

File tree

2 files changed

+153
-0
lines changed

2 files changed

+153
-0
lines changed

.github/workflows/__go-indirect-tracing-workaround-no-file-program.yml

Lines changed: 103 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "Go: diagnostic when `file` is not installed"
2+
description: "Checks that we emit a diagnostic if the `file` program is not installed"
3+
# only Linux is affected
4+
operatingSystems: ["ubuntu"]
5+
# pinned to a version which does not support statically linked binaries for indirect tracing
6+
versions: ["stable-v2.14.6"]
7+
steps:
8+
- uses: actions/setup-go@v5
9+
with:
10+
# We need a Go version that ships with statically linked binaries on Linux
11+
go-version: ">=1.21.0"
12+
- name: Remove `file` program
13+
run: |
14+
echo $(which file)
15+
sudo rm -rf $(which file)
16+
echo $(which file)
17+
- uses: ./../action/init
18+
with:
19+
languages: go
20+
tools: ${{ steps.prepare-test.outputs.tools-url }}
21+
- name: Build code
22+
shell: bash
23+
run: go build main.go
24+
- uses: ./../action/analyze
25+
with:
26+
output: "${{ runner.temp }}/results"
27+
upload-database: false
28+
- name: Check diagnostic appears in SARIF
29+
uses: actions/github-script@v7
30+
env:
31+
SARIF_PATH: "${{ runner.temp }}/results/go.sarif"
32+
with:
33+
script: |
34+
const fs = require('fs');
35+
36+
const sarif = JSON.parse(fs.readFileSync(process.env['SARIF_PATH'], 'utf8'));
37+
const run = sarif.runs[0];
38+
39+
const toolExecutionNotifications = run.invocations[0].toolExecutionNotifications;
40+
const statusPageNotifications = toolExecutionNotifications.filter(n =>
41+
n.descriptor.id === 'go/workflow/file-program-unavailable' && n.properties?.visibility?.statusPage
42+
);
43+
if (statusPageNotifications.length !== 1) {
44+
core.setFailed(
45+
'Expected exactly one status page reporting descriptor for this diagnostic in the ' +
46+
`'runs[].invocations[].toolExecutionNotifications[]' SARIF property, but found ` +
47+
`${statusPageNotifications.length}. All notification reporting descriptors: ` +
48+
`${JSON.stringify(toolExecutionNotifications)}.`
49+
);
50+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy