Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add unit tests #25

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ jobs:
args: --timeout=10m --out-format=line-number
skip-cache: true # https://github.com/golangci/golangci-lint-action/issues/244#issuecomment-1052197778

- name: unit tests
run: make test

build-sentryflow-image:
needs: [ files-changed ]
if: ${{ github.repository == '5GSEC/sentryflow' && needs.files-changed.outputs.sentryflow == 'true' }}
Expand Down
3 changes: 3 additions & 0 deletions sentryflow/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ lint: golangci-lint ## Run golangci-lint linter
license: ## Check and fix license header on all go files
@../scripts/add-license-header

.PHONY: test
test: ## Run unit tests
@go test -v ./...
##@ Build

.PHONY: build
Expand Down
1 change: 1 addition & 0 deletions sentryflow/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ require (
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240814211410-ddb44dafa142 // indirect
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
2 changes: 0 additions & 2 deletions sentryflow/go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
github.com/5GSEC/SentryFlow/protobuf v0.0.0-20240513071927-c6689c164ec8 h1:vOjDsj/1zs1O4V2UG2SINC7/maAx3WEQsE0bz5n0skI=
github.com/5GSEC/SentryFlow/protobuf v0.0.0-20240513071927-c6689c164ec8/go.mod h1:cvmCAKkLBDXx6Rlk97XQQuAtcOhkM/wsWNbxGOC3yfE=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
Expand Down
3 changes: 3 additions & 0 deletions sentryflow/pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ func (c *Config) validate() error {
if c.Exporter.Grpc == nil {
return fmt.Errorf("no exporter's gRPC configuration provided")
}
if c.Exporter.Grpc != nil && c.Exporter.Grpc.Port == 0 {
return fmt.Errorf("no exporter's gRPC port provided")
}
if c.Exporter.Http != nil {
return fmt.Errorf("http exporter is not supported")
}
Expand Down
Loading
Loading