Skip to content

Commit

Permalink
Merge branch 'main' into update-selinux-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
aphralG committed Nov 27, 2023
2 parents 799e0e7 + c6a292b commit 91ebb9e
Show file tree
Hide file tree
Showing 51 changed files with 1,154 additions and 465 deletions.
4 changes: 4 additions & 0 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Copyright (c) F5, Inc.

This source code is licensed under the Apache License, Version 2.0 license found in the
LICENSE file in the root directory of this source tree.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ include Makefile.packaging
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# Testing #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
generate-mocks: ## Regenerate all needed mocks, in order to add new mocks generation add //go:generate mockgen to file from witch mocks should be generated
generate-mocks: ## Regenerate all needed mocks, in order to add new mocks generation add //go:generate to file from witch mocks should be generated
GOWORK=off go generate ./...

test: unit-test performance-test component-test integration-test ## Run all tests
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ require (
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/fsnotify/fsnotify v1.6.0
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.3
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.3.1
Expand Down Expand Up @@ -47,6 +46,7 @@ require (
github.com/prometheus/client_golang v1.17.0
github.com/pseudomuto/protoc-gen-doc v1.5.1
github.com/rs/cors v1.10.1
go.uber.org/mock v0.3.0
golang.org/x/sys v0.14.0
golang.org/x/text v0.13.0
gopkg.in/yaml.v2 v2.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt
github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
Expand Down Expand Up @@ -1021,6 +1019,8 @@ go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.2.1 h1:NBol2c7O1ZokfZ0LEU9K6Whx/KnwvepVetCUhtKja4A=
go.uber.org/goleak v1.2.1/go.mod h1:qlT2yGI9QafXHhZZLxlSuNsMw3FFLxBr+tBRlmO1xH4=
go.uber.org/mock v0.3.0 h1:3mUxI1No2/60yUYax92Pt8eNOEecx2D3lcXZh2NEZJo=
go.uber.org/mock v0.3.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
Expand Down
2 changes: 1 addition & 1 deletion scripts/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
_ "github.com/go-swagger/go-swagger/cmd/swagger"
_ "github.com/gogo/protobuf/protoc-gen-gogo"
_ "github.com/gogo/protobuf/protoc-gen-gogofast"
_ "github.com/golang/mock/mockgen"
_ "github.com/golangci/golangci-lint/cmd/golangci-lint"
_ "github.com/goreleaser/nfpm/v2/cmd/nfpm"
_ "github.com/maxbrunsfeld/counterfeiter/v6"
_ "github.com/mwitkow/go-proto-validators/protoc-gen-govalidators"
_ "github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc"
_ "go.uber.org/mock/mockgen"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
_ "mvdan.cc/gofumpt"
)
4 changes: 2 additions & 2 deletions src/core/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ func (env *EnvironmentType) WriteFile(backup ConfigApplyMarker, file *proto.File
directory := filepath.Dir(fileFullPath)
_, err := os.Stat(directory)
if os.IsNotExist(err) {
log.Debugf("Creating directory %s with permissions 755", directory)
err = os.MkdirAll(directory, 0o755)
log.Debugf("Creating directory %s with permissions 750", directory)
err = os.MkdirAll(directory, 0o750)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/advanced-metrics/aggregator/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
log "github.com/sirupsen/logrus"
)

//go:generate mockgen -source aggregator.go -destination mocks/aggregator_mock.go -package mocks
//go:generate go run go.uber.org/mock/mockgen -source aggregator.go -destination mocks/aggregator_mock.go -package mocks -copyright_file=../../../../COPYRIGHT

type ReadTable interface {
ReadSnapshot(resetLookups bool) (tables.SamplesView, tables.LookupSet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"testing"
"time"

"github.com/golang/mock/gomock"
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/aggregator"
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/aggregator/mocks"
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/tables"
Expand All @@ -23,6 +22,7 @@ import (
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/tables/sample"
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/tables/schema"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)

func TestAggregatorPublish(t *testing.T) {
Expand Down
23 changes: 13 additions & 10 deletions src/extensions/advanced-metrics/aggregator/mocks/aggregator_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/extensions/advanced-metrics/ingester/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import (
log "github.com/sirupsen/logrus"
)

//go:generate mockgen -source ingester.go -destination mocks/ingester_mock.go -package mocks

//go:generate go run go.uber.org/mock/mockgen -source ingester.go -destination mocks/ingester_mock.go -package mocks -copyright_file=../../../../COPYRIGHT
const workers = 3

type StagingTable interface {
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/advanced-metrics/ingester/ingester_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"sync"
"testing"

"github.com/golang/mock/gomock"
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/ingester/mocks"
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/reader"
readerMock "github.com/nginx/agent/v2/src/extensions/advanced-metrics/reader/mocks"
"go.uber.org/mock/gomock"
)

func TestIngesterRunCanProcessIncomingData(t *testing.T) {
Expand Down
21 changes: 12 additions & 9 deletions src/extensions/advanced-metrics/ingester/mocks/ingester_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 11 additions & 14 deletions src/extensions/advanced-metrics/reader/mocks/net_mocks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 13 additions & 10 deletions src/extensions/advanced-metrics/reader/mocks/reader_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions src/extensions/advanced-metrics/reader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ import (
"golang.org/x/sync/errgroup"
)

//go:generate mockgen -source reader.go -destination mocks/reader_mock.go -package mocks
//go:generate mockgen -destination mocks/net_mocks.go -build_flags=--mod=mod -package mocks net Listener,Conn

//go:generate go run go.uber.org/mock/mockgen -source reader.go -destination mocks/reader_mock.go -package mocks -copyright_file=../../../../COPYRIGHT
//go:generate go run go.uber.org/mock/mockgen -destination mocks/net_mocks.go -build_flags=--mod=mod -package mocks net Listener,Conn
const (
networkType = "unix"
)
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/advanced-metrics/reader/reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"net"
"testing"

"github.com/golang/mock/gomock"
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/reader/mocks"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)

const address = "/tmp/advanced-metrics.sr"
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/advanced-metrics/reader/worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import (
"testing"
"time"

"github.com/golang/mock/gomock"
"github.com/nginx/agent/v2/src/extensions/advanced-metrics/reader/mocks"
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"go.uber.org/mock/gomock"
)

func TestWorkerStopAndCloseConnectionOnContexCancelation(t *testing.T) {
Expand Down
Loading

0 comments on commit 91ebb9e

Please sign in to comment.