@@ -11,18 +11,15 @@ import (
1111 "testing"
1212
1313 "github.com/spf13/cobra"
14- "github.com/stretchr/testify/assert"
1514 "github.com/stretchr/testify/require"
1615 tmcfg "github.com/tendermint/tendermint/config"
17- dbm "github.com/tendermint/tm-db"
1816
1917 "github.com/cosmos/cosmos-sdk/client"
2018 "github.com/cosmos/cosmos-sdk/client/flags"
2119 "github.com/cosmos/cosmos-sdk/server"
2220 "github.com/cosmos/cosmos-sdk/server/config"
2321 servertypes "github.com/cosmos/cosmos-sdk/server/types"
2422 "github.com/cosmos/cosmos-sdk/simapp"
25- "github.com/cosmos/cosmos-sdk/types"
2623 sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
2724 genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
2825)
@@ -450,76 +447,3 @@ func (m mapGetter) Get(key string) interface{} {
450447}
451448
452449var _ servertypes.AppOptions = mapGetter {}
453-
454- func TestGetAppDBBackend (t * testing.T ) {
455- origDBBackend := types .DBBackend
456- defer func () {
457- types .DBBackend = origDBBackend
458- }()
459- tests := []struct {
460- name string
461- dbBack string
462- opts mapGetter
463- exp dbm.BackendType
464- }{
465- {
466- name : "nothing set" ,
467- dbBack : "" ,
468- opts : mapGetter {},
469- exp : dbm .GoLevelDBBackend ,
470- },
471-
472- {
473- name : "only db-backend set" ,
474- dbBack : "" ,
475- opts : mapGetter {"db-backend" : "db-backend value 1" },
476- exp : dbm .BackendType ("db-backend value 1" ),
477- },
478- {
479- name : "only DBBackend set" ,
480- dbBack : "DBBackend value 2" ,
481- opts : mapGetter {},
482- exp : dbm .BackendType ("DBBackend value 2" ),
483- },
484- {
485- name : "only app-db-backend set" ,
486- dbBack : "" ,
487- opts : mapGetter {"app-db-backend" : "app-db-backend value 3" },
488- exp : dbm .BackendType ("app-db-backend value 3" ),
489- },
490-
491- {
492- name : "app-db-backend and db-backend set" ,
493- dbBack : "" ,
494- opts : mapGetter {"db-backend" : "db-backend value 4" , "app-db-backend" : "app-db-backend value 5" },
495- exp : dbm .BackendType ("app-db-backend value 5" ),
496- },
497- {
498- name : "app-db-backend and DBBackend set" ,
499- dbBack : "DBBackend value 6" ,
500- opts : mapGetter {"app-db-backend" : "app-db-backend value 7" },
501- exp : dbm .BackendType ("app-db-backend value 7" ),
502- },
503- {
504- name : "db-backend and DBBackend set" ,
505- dbBack : "DBBackend value 8" ,
506- opts : mapGetter {"db-backend" : "db-backend value 9" },
507- exp : dbm .BackendType ("DBBackend value 8" ),
508- },
509-
510- {
511- name : "all of app-db-backend db-backend DBBackend set" ,
512- dbBack : "DBBackend value 10" ,
513- opts : mapGetter {"db-backend" : "db-backend value 11" , "app-db-backend" : "app-db-backend value 12" },
514- exp : dbm .BackendType ("app-db-backend value 12" ),
515- },
516- }
517-
518- for _ , tc := range tests {
519- t .Run (tc .name , func (st * testing.T ) {
520- types .DBBackend = tc .dbBack
521- act := server .GetAppDBBackend (tc .opts )
522- assert .Equal (st , tc .exp , act )
523- })
524- }
525- }
0 commit comments