@@ -24,21 +24,23 @@ describe('DataSourceManagement: data_source_connection_validator.ts', () => {
24
24
expect ( validateDataSourcesResponse . statusCode ) . toBe ( 200 ) ;
25
25
} ) ;
26
26
27
- test ( 'fetchDataSourceVersion - Success: opensearch client response code is 200 and response body have version number' , async ( ) => {
27
+ test ( 'fetchDataSourceInfo - Success: opensearch client response code is 200 and response body have version number and distribution ' , async ( ) => {
28
28
const opensearchClient = opensearchServiceMock . createOpenSearchClient ( ) ;
29
29
opensearchClient . info . mockResolvedValue (
30
30
opensearchServiceMock . createApiResponse ( {
31
31
statusCode : 200 ,
32
32
body : {
33
33
version : {
34
34
number : '2.11.0' ,
35
+ distribution : 'opensearch' ,
35
36
} ,
36
37
} ,
37
38
} )
38
39
) ;
39
40
const dataSourceValidator = new DataSourceConnectionValidator ( opensearchClient , { } ) ;
40
- const fetchDataSourcesVersionResponse = await dataSourceValidator . fetchDataSourceVersion ( ) ;
41
- expect ( fetchDataSourcesVersionResponse ) . toBe ( '2.11.0' ) ;
41
+ const fetchDataSourcesVersionResponse = await dataSourceValidator . fetchDataSourceInfo ( ) ;
42
+ expect ( fetchDataSourcesVersionResponse . dataSourceVersion ) . toBe ( '2.11.0' ) ;
43
+ expect ( fetchDataSourcesVersionResponse . dataSourceEngineType ) . toBe ( 'OpenSearch' ) ;
42
44
} ) ;
43
45
44
46
test ( 'fetchInstalledPlugins - Success: opensearch client response code is 200 and response body have installed plugin list' , async ( ) => {
@@ -92,8 +94,8 @@ describe('DataSourceManagement: data_source_connection_validator.ts', () => {
92
94
}
93
95
} ) ;
94
96
95
- // In case fetchDataSourceVersion call succeeded yet did not return version number, return an empty version instead of raising exceptions
96
- test ( 'fetchDataSourceVersion - Success:opensearch client response code is 200 but response body does not have version number' , async ( ) => {
97
+ // In case fetchDataSourceInfo call succeeded yet did not return version number and distribution , return an empty info instead of raising exceptions
98
+ test ( 'fetchDataSourceInfo - Success:opensearch client response code is 200 but response body does not have version number' , async ( ) => {
97
99
const opensearchClient = opensearchServiceMock . createOpenSearchClient ( ) ;
98
100
opensearchClient . info . mockResolvedValue (
99
101
opensearchServiceMock . createApiResponse ( {
@@ -104,8 +106,9 @@ describe('DataSourceManagement: data_source_connection_validator.ts', () => {
104
106
} )
105
107
) ;
106
108
const dataSourceValidator = new DataSourceConnectionValidator ( opensearchClient , { } ) ;
107
- const fetchDataSourcesVersionResponse = await dataSourceValidator . fetchDataSourceVersion ( ) ;
108
- expect ( fetchDataSourcesVersionResponse ) . toBe ( '' ) ;
109
+ const fetchDataSourcesVersionResponse = await dataSourceValidator . fetchDataSourceInfo ( ) ;
110
+ expect ( fetchDataSourcesVersionResponse . dataSourceVersion ) . toBe ( '' ) ;
111
+ expect ( fetchDataSourcesVersionResponse . dataSourceEngineType ) . toBe ( 'No Engine Type Available' ) ;
109
112
} ) ;
110
113
111
114
test ( 'failure: opensearch client response code is other than 200' , async ( ) => {
@@ -130,8 +133,8 @@ describe('DataSourceManagement: data_source_connection_validator.ts', () => {
130
133
} ) ;
131
134
} ) ;
132
135
133
- // In case fetchDataSourceVersion call failed, return an empty version instead of raising exceptions
134
- test ( 'fetchDataSourceVersion - Failure: opensearch client response code is other than 200' , async ( ) => {
136
+ // In case fetchDataSourceInfo call failed, return an empty info instead of raising exceptions
137
+ test ( 'fetchDataSourceInfo - Failure: opensearch client response code is other than 200' , async ( ) => {
135
138
const statusCodeList = [ 100 , 202 , 300 , 400 , 500 ] ;
136
139
statusCodeList . forEach ( async function ( code ) {
137
140
const opensearchClient = opensearchServiceMock . createOpenSearchClient ( ) ;
@@ -144,8 +147,11 @@ describe('DataSourceManagement: data_source_connection_validator.ts', () => {
144
147
} )
145
148
) ;
146
149
const dataSourceValidator = new DataSourceConnectionValidator ( opensearchClient , { } ) ;
147
- const fetchDataSourcesVersionResponse = await dataSourceValidator . fetchDataSourceVersion ( ) ;
148
- expect ( fetchDataSourcesVersionResponse ) . toBe ( '' ) ;
150
+ const fetchDataSourcesVersionResponse = await dataSourceValidator . fetchDataSourceInfo ( ) ;
151
+ expect ( fetchDataSourcesVersionResponse . dataSourceVersion ) . toBe ( '' ) ;
152
+ expect ( fetchDataSourcesVersionResponse . dataSourceEngineType ) . toBe (
153
+ 'No Engine Type Available'
154
+ ) ;
149
155
} ) ;
150
156
} ) ;
151
157
} ) ;
0 commit comments