File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
redisinsight/api/src/modules/database/providers Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -112,6 +112,23 @@ describe('DatabaseFactory', () => {
112112
113113 expect ( result ) . toEqual ( mockClusterDatabaseWithTlsAuth ) ;
114114 } ) ;
115+ it ( 'should create standalone model when cluster database is passed but with standalone flag on' , async ( ) => {
116+ mockRedisSentinelUtil . isSentinel . mockResolvedValue ( false ) ;
117+ mockRedisClusterUtil . isCluster . mockResolvedValue ( true ) ;
118+
119+ const result = await service . createDatabaseModel ( mockSessionMetadata , {
120+ ...mockClusterDatabaseWithTlsAuth ,
121+ forceStandalone : true ,
122+ } ) ;
123+
124+ expect ( {
125+ forceStandalone : result . forceStandalone ,
126+ connectionType : result . connectionType ,
127+ } ) . toEqual ( {
128+ forceStandalone : true ,
129+ connectionType : ConnectionType . STANDALONE ,
130+ } ) ;
131+ } ) ;
115132 } ) ;
116133
117134 describe ( 'createStandaloneDatabaseModel' , ( ) => {
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export class DatabaseFactory {
7373 database ,
7474 client ,
7575 ) ;
76- } else if ( await isCluster ( client ) ) {
76+ } else if ( ! database . forceStandalone && ( await isCluster ( client ) ) ) {
7777 model = await this . createClusterDatabaseModel (
7878 sessionMetadata ,
7979 database ,
@@ -123,6 +123,7 @@ export class DatabaseFactory {
123123 * Fetches cluster nodes
124124 * Creates cluster client to validate connection. Disconnect after check
125125 * Creates database model for cluster connection type
126+ * @param sessionMetadata
126127 * @param database
127128 * @param client
128129 * @private
@@ -164,6 +165,7 @@ export class DatabaseFactory {
164165 * Fetches sentinel masters and align with defined one
165166 * Creates sentinel client to validate connection. Disconnect after check
166167 * Creates database model for cluster connection type
168+ * @param sessionMetadata
167169 * @param database
168170 * @param client
169171 * @private
You can’t perform that action at this time.
0 commit comments