Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/plugins/mongodb/handler_databases_discovery_test.go')
-rw-r--r--src/go/plugins/mongodb/handler_databases_discovery_test.go60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/go/plugins/mongodb/handler_databases_discovery_test.go b/src/go/plugins/mongodb/handler_databases_discovery_test.go
deleted file mode 100644
index 803fba298d5..00000000000
--- a/src/go/plugins/mongodb/handler_databases_discovery_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-package mongodb
-
-import (
- "errors"
- "reflect"
- "testing"
-
- "git.zabbix.com/ap/plugin-support/zbxerr"
-)
-
-func Test_databasesDiscoveryHandler(t *testing.T) {
- type args struct {
- s Session
- dbs []string
- }
-
- tests := []struct {
- name string
- args args
- want interface{}
- wantErr error
- }{
- {
- name: "Must return a list of databases",
- args: args{
- s: NewMockConn(),
- dbs: []string{"testdb", "local", "config"},
- },
- want: "[{\"{#DBNAME}\":\"config\"},{\"{#DBNAME}\":\"local\"},{\"{#DBNAME}\":\"testdb\"}]",
- wantErr: nil,
- },
- {
- name: "Must catch DB.DatabaseNames() error",
- args: args{
- s: NewMockConn(),
- dbs: []string{mustFail},
- },
- want: nil,
- wantErr: zbxerr.ErrorCannotFetchData,
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- for _, db := range tt.args.dbs {
- tt.args.s.DB(db)
- }
-
- got, err := databasesDiscoveryHandler(tt.args.s, nil)
- if !errors.Is(err, tt.wantErr) {
- t.Errorf("databasesDiscoveryHandler() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
-
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("databasesDiscoveryHandler() got = %v, want %v", got, tt.want)
- }
- })
- }
-}