diff options
author | Valery Piashchynski <[email protected]> | 2021-09-11 01:04:05 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-09-11 01:04:05 +0300 |
commit | 0c4dd160a3eec4d76b9b82799c55eea4c5f50629 (patch) | |
tree | abc3eef044d6da54e1ba118637564e4d911e0fa6 | |
parent | 6984e25ecdfc113400007c45fd69822f09b46ff0 (diff) |
Update .vscode settings
Update codecov
Update configs
Signed-off-by: Valery Piashchynski <[email protected]>
-rw-r--r-- | .vscode/settings.json | 12 | ||||
-rwxr-xr-x | Makefile | 60 | ||||
-rw-r--r-- | codecov.yml | 7 | ||||
-rw-r--r-- | plugins/broadcast/plugin.go | 6 | ||||
-rw-r--r-- | plugins/kv/plugin.go | 7 | ||||
-rw-r--r-- | plugins/memory/memorypubsub/pubsub.go | 2 | ||||
-rw-r--r-- | tests/plugins/broadcast/configs/.rr-broadcast-global.yaml | 2 | ||||
-rw-r--r-- | tests/plugins/broadcast/configs/.rr-broadcast-same-section.yaml | 2 | ||||
-rw-r--r-- | tests/plugins/kv/storage_plugin_test.go | 15 | ||||
-rw-r--r-- | tests/plugins/websockets/configs/.rr-websockets-allow.yaml | 1 | ||||
-rw-r--r-- | tests/plugins/websockets/configs/.rr-websockets-deny.yaml | 1 | ||||
-rw-r--r-- | tests/plugins/websockets/configs/.rr-websockets-init.yaml | 1 | ||||
-rw-r--r-- | tests/plugins/websockets/configs/.rr-websockets-stop.yaml | 1 |
13 files changed, 78 insertions, 39 deletions
diff --git a/.vscode/settings.json b/.vscode/settings.json index 8a0b4664..5bd8813b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,7 +5,19 @@ "boltdb", "gomemcache", "goridge", + "hget", + "hset", + "INMEMORY", + "memcachedkv", "memorykv", + "mexpire", + "mget", + "prefetch", + "proto", + "SETEX", + "srem", + "stretchr", + "unsub", "Upgrader", "websockets", "websocketsv" @@ -8,36 +8,36 @@ test_coverage: docker-compose -f tests/env/docker-compose.yaml up -d --remove-orphans rm -rf coverage-ci mkdir ./coverage-ci - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.txt -covermode=atomic ./pkg/transport/pipe - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.txt -covermode=atomic ./pkg/transport/socket - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pool.txt -covermode=atomic ./pkg/pool - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker.txt -covermode=atomic ./pkg/worker - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/bst.txt -covermode=atomic ./pkg/bst - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pq.txt -covermode=atomic ./pkg/priority_queue - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker_stack.txt -covermode=atomic ./pkg/worker_watcher - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/ws_origin.txt -covermode=atomic ./plugins/websockets - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/http_config.txt -covermode=atomic ./plugins/http/config - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/server_cmd.txt -covermode=atomic ./plugins/server - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/struct_jobs.txt -covermode=atomic ./plugins/jobs/job - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipeline_jobs.txt -covermode=atomic ./plugins/jobs/pipeline - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/jobs_core.txt -covermode=atomic ./tests/plugins/jobs - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/kv_plugin.txt -covermode=atomic ./tests/plugins/kv - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/broadcast_plugin.txt -covermode=atomic ./tests/plugins/broadcast - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/websockets.txt -covermode=atomic ./tests/plugins/websockets - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/http.txt -covermode=atomic ./tests/plugins/http - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/informer.txt -covermode=atomic ./tests/plugins/informer - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/reload.txt -covermode=atomic ./tests/plugins/reload - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/server.txt -covermode=atomic ./tests/plugins/server - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/service.txt -covermode=atomic ./tests/plugins/service - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/status.txt -covermode=atomic ./tests/plugins/status - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/config.txt -covermode=atomic ./tests/plugins/config - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/gzip.txt -covermode=atomic ./tests/plugins/gzip - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/headers.txt -covermode=atomic ./tests/plugins/headers - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/logger.txt -covermode=atomic ./tests/plugins/logger - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/metrics.txt -covermode=atomic ./tests/plugins/metrics - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/resetter.txt -covermode=atomic ./tests/plugins/resetter - go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/rpc.txt -covermode=atomic ./tests/plugins/rpc - cat ./coverage-ci/*.txt > ./coverage-ci/summary.txt + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipe.out -covermode=atomic ./pkg/transport/pipe + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/socket.out -covermode=atomic ./pkg/transport/socket + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pool.out -covermode=atomic ./pkg/pool + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker.out -covermode=atomic ./pkg/worker + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/bst.out -covermode=atomic ./pkg/bst + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pq.out -covermode=atomic ./pkg/priority_queue + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/worker_stack.out -covermode=atomic ./pkg/worker_watcher + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/ws_origin.out -covermode=atomic ./plugins/websockets + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/http_config.out -covermode=atomic ./plugins/http/config + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/server_cmd.out -covermode=atomic ./plugins/server + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/struct_jobs.out -covermode=atomic ./plugins/jobs/job + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/pipeline_jobs.out -covermode=atomic ./plugins/jobs/pipeline + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/jobs_core.out -covermode=atomic ./tests/plugins/jobs + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/kv_plugin.out -covermode=atomic ./tests/plugins/kv + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/broadcast_plugin.out -covermode=atomic ./tests/plugins/broadcast + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/websockets.out -covermode=atomic ./tests/plugins/websockets + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/http.out -covermode=atomic ./tests/plugins/http + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/informer.out -covermode=atomic ./tests/plugins/informer + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/reload.out -covermode=atomic ./tests/plugins/reload + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/server.out -covermode=atomic ./tests/plugins/server + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/service.out -covermode=atomic ./tests/plugins/service + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/status.out -covermode=atomic ./tests/plugins/status + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/config.out -covermode=atomic ./tests/plugins/config + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/gzip.out -covermode=atomic ./tests/plugins/gzip + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/headers.out -covermode=atomic ./tests/plugins/headers + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/logger.out -covermode=atomic ./tests/plugins/logger + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/metrics.out -covermode=atomic ./tests/plugins/metrics + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/resetter.out -covermode=atomic ./tests/plugins/resetter + go test -v -race -cover -tags=debug -coverpkg=./... -coverprofile=./coverage-ci/rpc.out -covermode=atomic ./tests/plugins/rpc + cat ./coverage-ci/*.out > ./coverage-ci/summary.out docker-compose -f tests/env/docker-compose.yaml down test: ## Run application tests diff --git a/codecov.yml b/codecov.yml index d895d264..af46376a 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,16 +3,19 @@ coverage: project: default: target: auto - threshold: 0% + threshold: 50% informational: true patch: default: target: auto - threshold: 0% + threshold: 50% informational: true # do not include tests folders ignore: + - "common" + - "internal" + - "proto" - "tests" - "plugins/metrics/config_test.go" - "plugins/websockets/storage/storage_test.go" diff --git a/plugins/broadcast/plugin.go b/plugins/broadcast/plugin.go index 47b68fe7..40263eaa 100644 --- a/plugins/broadcast/plugin.go +++ b/plugins/broadcast/plugin.go @@ -53,7 +53,7 @@ func (p *Plugin) Init(cfg config.Configurer, log logger.Logger) error { } func (p *Plugin) Serve() chan error { - return make(chan error) + return make(chan error, 1) } func (p *Plugin) Stop() error { @@ -158,7 +158,7 @@ func (p *Plugin) GetDriver(key string) (pubsub.SubReader, error) { p.publishers[configKey] = ps return ps, nil - default: + case p.cfgPlugin.Has(key): // try global driver section after local ps, err := p.constructors[drStr].PSConstruct(key) if err != nil { @@ -170,6 +170,8 @@ func (p *Plugin) GetDriver(key string) (pubsub.SubReader, error) { p.publishers[configKey] = ps return ps, nil + default: + p.log.Error("can't find local or global configuration, this section will be skipped", "local: ", configKey, "global: ", key) } } } diff --git a/plugins/kv/plugin.go b/plugins/kv/plugin.go index a2b36e3e..86bd982f 100644 --- a/plugins/kv/plugin.go +++ b/plugins/kv/plugin.go @@ -99,7 +99,8 @@ func (p *Plugin) Serve() chan error { // save the storage p.storages[k] = storage - default: + // try global then + case p.cfgPlugin.Has(k): if _, ok := p.constructors[drStr]; !ok { p.log.Warn("no constructors registered", "requested constructor", drStr, "registered", p.constructors) continue @@ -114,9 +115,11 @@ func (p *Plugin) Serve() chan error { // save the storage p.storages[k] = storage + default: + p.log.Error("can't find local or global configuration, this section will be skipped", "local: ", configKey, "global: ", k) + continue } } - continue } diff --git a/plugins/memory/memorypubsub/pubsub.go b/plugins/memory/memorypubsub/pubsub.go index 75122571..231da134 100644 --- a/plugins/memory/memorypubsub/pubsub.go +++ b/plugins/memory/memorypubsub/pubsub.go @@ -21,7 +21,7 @@ type PubSubDriver struct { func NewPubSubDriver(log logger.Logger, _ string) (*PubSubDriver, error) { ps := &PubSubDriver{ - pushCh: make(chan *pubsub.Message, 10), + pushCh: make(chan *pubsub.Message, 100), storage: bst.NewBST(), log: log, } diff --git a/tests/plugins/broadcast/configs/.rr-broadcast-global.yaml b/tests/plugins/broadcast/configs/.rr-broadcast-global.yaml index d3cf2306..a7f9c35d 100644 --- a/tests/plugins/broadcast/configs/.rr-broadcast-global.yaml +++ b/tests/plugins/broadcast/configs/.rr-broadcast-global.yaml @@ -40,8 +40,10 @@ broadcast: - "127.0.0.1:6378" test3: driver: memory + config: {} test4: driver: memory + config: {} logs: mode: development diff --git a/tests/plugins/broadcast/configs/.rr-broadcast-same-section.yaml b/tests/plugins/broadcast/configs/.rr-broadcast-same-section.yaml index b42834a9..85a767cb 100644 --- a/tests/plugins/broadcast/configs/.rr-broadcast-same-section.yaml +++ b/tests/plugins/broadcast/configs/.rr-broadcast-same-section.yaml @@ -39,8 +39,10 @@ broadcast: - "127.0.0.1:6378" test3: driver: memory + config: {} test4: driver: memory + config: {} logs: mode: development level: info diff --git a/tests/plugins/kv/storage_plugin_test.go b/tests/plugins/kv/storage_plugin_test.go index ec9e74fd..c10e4726 100644 --- a/tests/plugins/kv/storage_plugin_test.go +++ b/tests/plugins/kv/storage_plugin_test.go @@ -10,6 +10,7 @@ import ( "testing" "time" + "github.com/golang/mock/gomock" endure "github.com/spiral/endure/pkg/container" goridgeRpc "github.com/spiral/goridge/v3/pkg/rpc" "github.com/spiral/roadrunner/v2/plugins/boltdb" @@ -21,6 +22,7 @@ import ( "github.com/spiral/roadrunner/v2/plugins/redis" rpcPlugin "github.com/spiral/roadrunner/v2/plugins/rpc" payload "github.com/spiral/roadrunner/v2/proto/kv/v1beta" + "github.com/spiral/roadrunner/v2/tests/mocks" "github.com/stretchr/testify/assert" ) @@ -1293,12 +1295,21 @@ func TestRedisNoConfig(t *testing.T) { Prefix: "rr", } + controller := gomock.NewController(t) + mockLogger := mocks.NewMockLogger(controller) + + mockLogger.EXPECT().Debug("worker destructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("worker constructed", "pid", gomock.Any()).AnyTimes() + mockLogger.EXPECT().Debug("Started RPC service", "address", "tcp://127.0.0.1:6001", "plugins", []string{"kv"}).AnyTimes() + + mockLogger.EXPECT().Error(`can't find local or global configuration, this section will be skipped`, "local: ", "kv.redis-rr.config", "global: ", "redis-rr").Times(1) + err = cont.RegisterAll( cfg, &kv.Plugin{}, &redis.Plugin{}, &rpcPlugin.Plugin{}, - &logger.ZapLogger{}, + mockLogger, &memory.Plugin{}, ) assert.NoError(t, err) @@ -1309,7 +1320,7 @@ func TestRedisNoConfig(t *testing.T) { } _, err = cont.Serve() - assert.Error(t, err) + assert.NoError(t, err) } func testRPCMethodsRedis(t *testing.T) { diff --git a/tests/plugins/websockets/configs/.rr-websockets-allow.yaml b/tests/plugins/websockets/configs/.rr-websockets-allow.yaml index 9c46ef6e..3d0268d4 100644 --- a/tests/plugins/websockets/configs/.rr-websockets-allow.yaml +++ b/tests/plugins/websockets/configs/.rr-websockets-allow.yaml @@ -35,6 +35,7 @@ redis: broadcast: test: driver: memory + config: {} websockets: broker: test diff --git a/tests/plugins/websockets/configs/.rr-websockets-deny.yaml b/tests/plugins/websockets/configs/.rr-websockets-deny.yaml index c5bea82f..61265c4b 100644 --- a/tests/plugins/websockets/configs/.rr-websockets-deny.yaml +++ b/tests/plugins/websockets/configs/.rr-websockets-deny.yaml @@ -31,6 +31,7 @@ http: broadcast: test: driver: memory + config: {} websockets: broker: test diff --git a/tests/plugins/websockets/configs/.rr-websockets-init.yaml b/tests/plugins/websockets/configs/.rr-websockets-init.yaml index 7de9dff8..3120f146 100644 --- a/tests/plugins/websockets/configs/.rr-websockets-init.yaml +++ b/tests/plugins/websockets/configs/.rr-websockets-init.yaml @@ -31,6 +31,7 @@ http: broadcast: default: driver: memory + config: {} websockets: broker: default diff --git a/tests/plugins/websockets/configs/.rr-websockets-stop.yaml b/tests/plugins/websockets/configs/.rr-websockets-stop.yaml index ba4b21f1..35529e9e 100644 --- a/tests/plugins/websockets/configs/.rr-websockets-stop.yaml +++ b/tests/plugins/websockets/configs/.rr-websockets-stop.yaml @@ -31,6 +31,7 @@ http: broadcast: test: driver: memory + config: {} websockets: broker: test |