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', () => {
112
112
113
113
expect ( result ) . toEqual ( mockClusterDatabaseWithTlsAuth ) ;
114
114
} ) ;
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
+ } ) ;
115
132
} ) ;
116
133
117
134
describe ( 'createStandaloneDatabaseModel' , ( ) => {
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export class DatabaseFactory {
73
73
database ,
74
74
client ,
75
75
) ;
76
- } else if ( await isCluster ( client ) ) {
76
+ } else if ( ! database . forceStandalone && ( await isCluster ( client ) ) ) {
77
77
model = await this . createClusterDatabaseModel (
78
78
sessionMetadata ,
79
79
database ,
@@ -123,6 +123,7 @@ export class DatabaseFactory {
123
123
* Fetches cluster nodes
124
124
* Creates cluster client to validate connection. Disconnect after check
125
125
* Creates database model for cluster connection type
126
+ * @param sessionMetadata
126
127
* @param database
127
128
* @param client
128
129
* @private
@@ -164,6 +165,7 @@ export class DatabaseFactory {
164
165
* Fetches sentinel masters and align with defined one
165
166
* Creates sentinel client to validate connection. Disconnect after check
166
167
* Creates database model for cluster connection type
168
+ * @param sessionMetadata
167
169
* @param database
168
170
* @param client
169
171
* @private
You can’t perform that action at this time.
0 commit comments