Skip to content

Commit df88ab7

Browse files
committed
update makefile to separate unit, integration and cloud tests
1 parent 6589cec commit df88ab7

File tree

5 files changed

+35
-10
lines changed

5 files changed

+35
-10
lines changed

.github/workflows/go.yml

+20-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,24 @@ jobs:
2424
with:
2525
version: v1.64
2626

27-
test:
28-
name: Test
27+
test-unit:
28+
name: Test Unit
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Go
35+
uses: actions/setup-go@v5
36+
with:
37+
go-version: '1.24'
38+
cache: true
39+
40+
- name: Run unit tests
41+
run: make test-unit
42+
43+
test-integration:
44+
name: Test Integration
2945
runs-on: ubuntu-latest
3046
steps:
3147
- name: Checkout code
@@ -48,8 +64,8 @@ jobs:
4864
- name: Wait for Grafana server and Prometheus server to start and scrape
4965
run: sleep 30
5066

51-
- name: Run tests
52-
run: make test-all
67+
- name: Run integration tests
68+
run: make test-integration
5369

5470
test-cloud:
5571
name: Test Cloud

Makefile

+6-6
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ build-image: ## Build the Docker image.
1616
lint: ## Lint the Go code.
1717
go tool -modfile go.tools.mod golangci-lint run
1818

19-
.PHONY: test
20-
test: ## Run the Go unit tests.
21-
go test ./...
19+
.PHONY: test-unit
20+
test-unit: ## Run the unit tests (no external dependencies required).
21+
go test -v -tags unit ./...
2222

23-
.PHONY: test-all
24-
test-all: ## Run the Go unit and integration tests.
23+
.PHONY: test-integration
24+
test-integration: ## Run only the Docker-based integration tests (Requires docker containers to be up and running).
2525
go test -v -tags integration ./...
2626

2727
.PHONY: test-cloud
28-
test-cloud: ## Run only the cloud tests.
28+
test-cloud: ## Run only the cloud-based tests (requires cloud Grafana instance and credentials).
2929
go test -v -tags cloud ./tools
3030

3131
.PHONY: run

mcpgrafana_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build unit
2+
// +build unit
3+
14
package mcpgrafana
25

36
import (

tools/incident_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build unit
2+
// +build unit
3+
14
package tools
25

36
import (

tools_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//go:build unit
2+
// +build unit
3+
14
package mcpgrafana
25

36
import (

0 commit comments

Comments
 (0)