Skip to content

Commit

Permalink
GHactions count tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmachard committed Nov 13, 2023
1 parent 9583688 commit 272a61d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
26 changes: 25 additions & 1 deletion .github/workflows/testing-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,28 @@ jobs:
cd prometheus-$PROM_VERSION.linux-amd64/
curl -u admin:changeme http://127.0.0.1:8081/metrics | ./promtool check metrics
env:
PROM_VERSION: "2.47.0"
PROM_VERSION: "2.47.0"

count:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: "1.21"

- id: count_tests
run: |
data=$(sudo go test -v ./collectors ./processors ./dnsutils ./netlib ./loggers ./transformers 2>&1 | grep -c RUN)
echo "Count of Tests: $data"
echo "data=$data" >> $GITHUB_OUTPUT
- id: count_lines
run: |
data=$(find . -name "*.go" -exec grep -v "^$" {} \; -exec grep -v "//" {} \; | wc -l)
echo "Count of Lines: $data"
echo "data=$data" >> $GITHUB_OUTPUT
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ version: build
lint:
$(GOPATH)/bin/golangci-lint run --config=.golangci.yml ./...

test:
tests:
@go test ./dnsutils/ -race -cover -v
@go test ./netlib/ -race -cover -v
@go test -timeout 30s ./transformers/ -race -cover -v
@go test -timeout 30s ./collectors/ -race -cover -v
@go test -timeout 90s ./loggers/ -race -cover -v
@go test -timeout 30s ./processors/ -race -cover -v

clean:
@go clean
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ make lint
Execute testunits before to commit

```bash
sudo make test
sudo make tests
```

Execute a test for one specific testcase in a package
Expand Down

0 comments on commit 272a61d

Please sign in to comment.