Skip to content

Commit

Permalink
test: Add unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Anurag Rajawat <[email protected]>
  • Loading branch information
anurag-rajawat committed Oct 29, 2024
1 parent 9c607e1 commit 1a267cc
Show file tree
Hide file tree
Showing 17 changed files with 1,581 additions and 48 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pr-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,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:
name: Build SentryFlow container image
runs-on: ubuntu-latest
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

0 comments on commit 1a267cc

Please sign in to comment.