Skip to content

Commit 34d3ed9

Browse files
committed
Fix e2e tests. Ensure CI runs them
1 parent 6e8baba commit 34d3ed9

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,32 @@ jobs:
3737
exit 1
3838
fi
3939
40-
- name: Run tests
41-
run: go test -v -race -coverprofile=coverage.out ./...
40+
- name: Run unit tests
41+
run: go test -v -race -coverprofile=coverage.out ./internal/...
4242

4343
- name: Upload coverage
4444
uses: codecov/codecov-action@v4
4545
with:
4646
files: coverage.out
4747
fail_ci_if_error: false
4848

49+
e2e:
50+
runs-on: ubuntu-latest
51+
needs: build
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Set up Go
56+
uses: actions/setup-go@v5
57+
with:
58+
go-version: '1.21'
59+
60+
- name: Build binary
61+
run: go build -o bin/metrics-analyzer ./cmd/metrics-analyzer
62+
63+
- name: Run E2E tests
64+
run: go test -v ./cmd/...
65+
4966
validate-rules:
5067
runs-on: ubuntu-latest
5168
needs: build

cmd/metrics-analyzer/main_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func TestE2EAnalyzeCommand(t *testing.T) {
2828
"analyze",
2929
"--rules", "../../testdata/fixtures",
3030
"--format", "markdown",
31+
"--template", "../../templates/markdown.tmpl",
3132
"--output", "/tmp/test_e2e_report.md",
3233
"../../testdata/fixtures/sample_metrics.txt",
3334
},
@@ -209,9 +210,12 @@ func TestE2EFullWorkflow(t *testing.T) {
209210
metricsPath := filepath.Join("..", "..", "testdata", "fixtures", "sample_metrics.txt")
210211
rulesPath := filepath.Join("..", "..", "testdata", "fixtures")
211212

213+
templatePath := filepath.Join("..", "..", "templates", "markdown.tmpl")
214+
212215
cmd := exec.Command(absPath, "analyze",
213216
"--rules", rulesPath,
214217
"--format", "markdown",
218+
"--template", templatePath,
215219
"--output", "/tmp/e2e_test_report.md",
216220
metricsPath,
217221
)

0 commit comments

Comments
 (0)