Skip to content

Commit 2f62240

Browse files
xavpaiceDexterYan
andauthored
remove redundant tests (#1677)
* remove redundant tests * fix workflow syntax error * fix workflow syntax error * fix k3s version for tests * fix k3s version for tests * f * add vet to test-integration --------- Co-authored-by: Dexter Yan <[email protected]>
1 parent 40eef3c commit 2f62240

File tree

2 files changed

+14
-123
lines changed

2 files changed

+14
-123
lines changed

.github/workflows/build-test-deploy.yaml

Lines changed: 12 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,6 @@ jobs:
2727
- name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass.
2828
run: exit 1
2929

30-
test:
31-
runs-on: ubuntu-latest
32-
steps:
33-
- uses: actions/checkout@v4
34-
with:
35-
fetch-depth: 0
36-
- uses: actions/setup-go@v5
37-
with:
38-
go-version: "1.22"
39-
- name: setup env
40-
run: |
41-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
42-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
43-
shell: bash
44-
- name: Run linters
45-
run: make install-golangci-lint lint
46-
- name: Run tests
47-
run: make test
48-
4930
test-integration:
5031
runs-on: ubuntu-latest
5132
steps:
@@ -63,8 +44,8 @@ jobs:
6344
- uses: replicatedhq/action-k3s@main
6445
id: k3s
6546
with:
66-
version: v1.24.1-k3s1
67-
47+
version: v1.31.2-k3s1
48+
# test-integration includes unit tests
6849
- run: make test-integration
6950

7051
ensure-schemas-are-generated:
@@ -104,54 +85,6 @@ jobs:
10485
name: preflight
10586
path: bin/preflight
10687

107-
validate-preflight:
108-
runs-on: ubuntu-latest
109-
needs: compile-preflight
110-
steps:
111-
- uses: replicatedhq/action-k3s@main
112-
id: k3s
113-
with:
114-
version: v1.23.6-k3s1
115-
- name: Download preflight binary
116-
uses: actions/download-artifact@v4
117-
with:
118-
name: preflight
119-
path: bin/
120-
- run: chmod +x bin/preflight
121-
- run: |
122-
set +e
123-
./bin/preflight --interactive=false --format=json https://preflight.replicated.com > result.json
124-
EXIT_CODE=$?
125-
cat result.json
126-
127-
EXIT_STATUS=0
128-
if [ $EXIT_CODE -ne 3 ]; then
129-
echo "Expected exit code of 3 (some checks failed), got $EXIT_CODE"
130-
EXIT_STATUS=1
131-
fi
132-
133-
if grep -q "was not collected" result.json; then
134-
echo "Some files were not collected"
135-
EXIT_STATUS=1
136-
fi
137-
138-
if (( `jq '.pass | length' result.json` < 1 )); then
139-
echo "No passing preflights found"
140-
EXIT_STATUS=1
141-
fi
142-
143-
if (( `jq '.warn | length' result.json` < 1 )); then
144-
echo "No warnings found"
145-
EXIT_STATUS=1
146-
fi
147-
148-
if (( `jq '.fail | length' result.json` < 1 )); then
149-
echo "No failed preflights found"
150-
EXIT_STATUS=1
151-
fi
152-
153-
exit $EXIT_STATUS
154-
15588
validate-preflight-e2e:
15689
runs-on: ubuntu-latest
15790
needs: compile-preflight
@@ -160,7 +93,7 @@ jobs:
16093
- uses: replicatedhq/action-k3s@main
16194
id: k3s
16295
with:
163-
version: v1.23.6-k3s1
96+
version: v1.31.2-k3s1
16497
- name: Download preflight binary
16598
uses: actions/download-artifact@v4
16699
with:
@@ -193,25 +126,6 @@ jobs:
193126
name: support-bundle
194127
path: bin/support-bundle
195128

196-
validate-supportbundle:
197-
runs-on: ubuntu-latest
198-
needs: compile-supportbundle
199-
steps:
200-
- uses: actions/checkout@v4
201-
- uses: replicatedhq/action-k3s@main
202-
id: k3s
203-
with:
204-
version: v1.23.6-k3s1
205-
- name: Download support-bundle binary
206-
uses: actions/download-artifact@v4
207-
with:
208-
name: support-bundle
209-
path: bin/
210-
- run: chmod +x bin/support-bundle
211-
- run: ./bin/support-bundle ./examples/support-bundle/sample-collectors.yaml
212-
- run: ./bin/support-bundle ./examples/support-bundle/sample-supportbundle.yaml
213-
- run: ./bin/support-bundle https://kots.io
214-
215129
validate-supportbundle-e2e:
216130
runs-on: ubuntu-latest
217131
needs: compile-supportbundle
@@ -220,27 +134,20 @@ jobs:
220134
- uses: replicatedhq/action-k3s@main
221135
id: k3s
222136
with:
223-
version: v1.23.6-k3s1
137+
version: v1.31.2-k3s1
224138
- name: Download support bundle binary
225139
uses: actions/download-artifact@v4
226140
with:
227141
name: support-bundle
228142
path: bin/
229143
- run: chmod +x bin/support-bundle
230144
- run: make support-bundle-e2e-test
231-
232-
validate-supportbundle-e2e-go-test:
233-
runs-on: ubuntu-latest
234-
needs: compile-supportbundle
235-
steps:
236-
- uses: actions/setup-go@v5
237-
with:
238-
go-version: "1.22"
239-
- name: setup env
240-
run: |
241-
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
242-
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
243-
shell: bash
145+
146+
# Additional e2e tests for support bundle that run in Go, these create a Kind cluster
147+
validate-supportbundle-e2e-go:
148+
runs-on: ubuntu-latest
149+
needs: compile-supportbundle
150+
steps:
244151
- uses: actions/checkout@v4
245152
- name: Download support bundle binary
246153
uses: actions/download-artifact@v4
@@ -308,9 +215,8 @@ jobs:
308215
goreleaser:
309216
runs-on: ubuntu-latest
310217
needs:
311-
- validate-preflight
312218
- validate-preflight-e2e
313-
- validate-supportbundle
219+
- validate-supportbundle-e2e
314220
if: startsWith(github.ref, 'refs/tags/v')
315221
steps:
316222
- name: Checkout
@@ -367,15 +273,12 @@ jobs:
367273
validate-pr-tests:
368274
runs-on: ubuntu-latest
369275
needs:
370-
- test
371276
- test-integration
372277
- run-examples
373278
- compile-collect
374-
- validate-preflight
375279
- validate-preflight-e2e
376-
- validate-supportbundle
377280
- validate-supportbundle-e2e
378-
- validate-supportbundle-e2e-go-test
281+
- validate-supportbundle-e2e-go
379282
- ensure-schemas-are-generated
380283
steps:
381284
- run: echo "All PR tests passed"

Makefile

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ test: generate fmt vet
5959
# Go tests that require a K8s instance
6060
# TODOLATER: merge with test, so we get unified coverage reports? it'll add 21~sec to the test job though...
6161
.PHONY: test-integration
62-
test-integration:
63-
go test -v --tags "integration exclude_graphdriver_devicemapper exclude_graphdriver_btrfs" ${BUILDPATHS}
62+
test-integration: generate fmt vet
63+
go test -v --tags="integration exclude_graphdriver_devicemapper exclude_graphdriver_btrfs" ${BUILDPATHS}
6464

6565
.PHONY: preflight-e2e-test
6666
preflight-e2e-test:
@@ -237,18 +237,6 @@ scan:
237237
--ignore-unfixed \
238238
./
239239

240-
.PHONY: lint
241-
lint: vet
242-
golangci-lint run --new -c .golangci.yaml --build-tags ${BUILDTAGS} ${BUILDPATHS}
243-
244-
.PHONY: lint-and-fix
245-
lint-and-fix: fmt vet
246-
golangci-lint run --new --fix -c .golangci.yaml --build-tags ${BUILDTAGS} ${BUILDPATHS}
247-
248-
.PHONY: install-golangci-lint
249-
install-golangci-lint:
250-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION}
251-
252240
.PHONY: watch
253241
watch: npm-install
254242
bin/watch.js

0 commit comments

Comments
 (0)