Skip to content

Commit 27ca26d

Browse files
authored
Ensure we have lint/lint-test in all go based modules (#276)
Signed-off-by: Davanum Srinivas <[email protected]>
1 parent 9dc9b84 commit 27ca26d

File tree

11 files changed

+496
-106
lines changed

11 files changed

+496
-106
lines changed

.github/workflows/lint-test.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,15 @@ jobs:
137137
- platform-connectors
138138
- store-client
139139
- commons
140+
- data-models
140141
- health-events-analyzer
141142
- fault-quarantine
142143
- labeler
143144
- metadata-collector
144145
- node-drainer
145146
- fault-remediation
146147
- janitor
148+
- tests
147149
steps:
148150
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
149151

@@ -162,11 +164,36 @@ jobs:
162164
${{ matrix.component }}/coverage.txt
163165
${{ matrix.component }}/report.xml
164166
167+
tilt-modules-lint-test:
168+
runs-on: linux-amd64-cpu16
169+
timeout-minutes: 30
170+
strategy:
171+
matrix:
172+
component:
173+
- tilt/simple-health-client
174+
steps:
175+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
176+
177+
- name: Setup build environment
178+
uses: ./.github/actions/setup-ci-env
179+
180+
- name: Run lint and test
181+
run: make -C ${{ matrix.component }} lint-test
182+
183+
- name: Upload artifacts
184+
uses: ./.github/actions/upload-test-artifacts
185+
with:
186+
component-name: simple-health-client
187+
file-paths: |
188+
${{ matrix.component }}/coverage.xml
189+
${{ matrix.component }}/coverage.txt
190+
${{ matrix.component }}/report.xml
191+
165192
consolidated-coverage-report:
166193
if: github.event_name == 'pull_request' || startsWith(github.ref, 'refs/heads/pull-request/')
167194
runs-on: linux-amd64-cpu16
168195
timeout-minutes: 15
169-
needs: [health-monitors-lint-test, modules-lint-test]
196+
needs: [health-monitors-lint-test, modules-lint-test, tilt-modules-lint-test]
170197
steps:
171198
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
172199

@@ -363,7 +390,7 @@ jobs:
363390
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
364391
runs-on: linux-amd64-cpu16
365392
timeout-minutes: 15
366-
needs: [health-monitors-lint-test, modules-lint-test]
393+
needs: [health-monitors-lint-test, modules-lint-test, tilt-modules-lint-test]
367394
steps:
368395
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
369396

tests/Makefile

Lines changed: 54 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,47 @@
11
# Tests Makefile
22
# End-to-end test targets
33

4-
# Go binary
5-
GO := go
4+
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
# =============================================================================
19+
# MODULE-SPECIFIC CONFIGURATION
20+
# =============================================================================
21+
22+
# E2E Tests module configuration
23+
IS_GO_MODULE := 1
24+
TEST_EXTRA_FLAGS := -timeout 40m -count 1 -failfast
25+
26+
# =============================================================================
27+
# INCLUDE COMMON DEFINITIONS
28+
# =============================================================================
29+
30+
include ../make/common.mk
31+
include ../make/go.mk
32+
33+
# =============================================================================
34+
# E2E-SPECIFIC TARGETS
35+
# =============================================================================
636

737
# Default target
838
.PHONY: all
939
all: test
1040

41+
.PHONY: lint-test
42+
lint-test: lint ## Run linting only (override go.mk comprehensive version)
43+
@echo "Linting complete for $(MODULE_NAME)"
44+
1145
# Run end-to-end tests in CI
1246
.PHONY: test-ci
1347
test-ci:
@@ -21,18 +55,27 @@ test-ci:
2155
kubectl rollout status deployment/fault-quarantine -n nvsentinel --timeout=10m
2256
$(MAKE) test
2357

24-
# Run end-to-end tests
58+
# Run end-to-end tests (override standard test to use gotestsum with custom format)
2559
.PHONY: test
26-
test:
27-
gotestsum --format standard-verbose -- -timeout 40m -count 1 -failfast ./...
60+
test: ## Run end-to-end tests
61+
@echo "Running end-to-end tests on $(MODULE_NAME)..."
62+
$(GOTESTSUM) --format standard-verbose -- $(TEST_EXTRA_FLAGS) ./... -coverprofile=coverage.txt -covermode atomic -coverpkg=github.com/nvidia/nvsentinel/$(MODULE_NAME)/...
2863

29-
# Help target
30-
.PHONY: help
31-
help:
32-
@echo "Tests Makefile - Simple end-to-end test execution"
64+
# =============================================================================
65+
# MODULE HELP
66+
# =============================================================================
67+
68+
help: ## Show help for available targets
69+
@echo "Tests Makefile - E2E test execution with standard linting"
70+
@echo ""
71+
@echo "Standard targets from go.mk:"
72+
@echo " lint-test - Lint and test Go module (vet + golangci-lint + gotestsum)"
73+
@echo " lint - Run golangci-lint"
74+
@echo " vet - Run go vet"
75+
@echo " test - Run end-to-end tests with coverage"
76+
@echo " clean - Clean build artifacts"
3377
@echo ""
34-
@echo "Targets:"
78+
@echo "E2E-specific targets:"
3579
@echo " all - Run test (default)"
3680
@echo " test-ci - Run end-to-end tests in CI environment"
37-
@echo " test - Run end-to-end tests"
3881
@echo " help - Show this help message"

0 commit comments

Comments
 (0)