77 SOUP_CLASS_NAME ,
88} from '../utils/testData' ;
99
10- const EXPECTED_WEAVIATE_VERSION = '1.22.0 ' ;
11- const EXPECTED_WEAVIATE_GIT_HASH = 'b4f2ffb ' ;
10+ const EXPECTED_WEAVIATE_VERSION = '1.23.0-rc.1 ' ;
11+ const EXPECTED_WEAVIATE_GIT_HASH = '841915f ' ;
1212
1313describe ( 'cluster nodes endpoint' , ( ) => {
1414 const client = weaviate . client ( {
@@ -19,6 +19,7 @@ describe('cluster nodes endpoint', () => {
1919 it ( 'get nodes status of empty db' , ( ) => {
2020 return client . cluster
2121 . nodesStatusGetter ( )
22+ . withOutput ( 'verbose' )
2223 . do ( )
2324 . then ( ( nodesStatusResponse : NodesStatusResponse ) => {
2425 expect ( nodesStatusResponse . nodes ) . toBeDefined ( ) ;
@@ -44,9 +45,10 @@ describe('cluster nodes endpoint', () => {
4445
4546 it ( 'sets up db' , ( ) => createTestFoodSchemaAndData ( client ) ) ;
4647
47- it ( 'get nodes status of food db' , ( ) => {
48+ it ( 'get verbose nodes status of food db' , ( ) => {
4849 return client . cluster
4950 . nodesStatusGetter ( )
51+ . withOutput ( 'verbose' )
5052 . do ( )
5153 . then ( ( nodesStatusResponse : NodesStatusResponse ) => {
5254 expect ( nodesStatusResponse . nodes ) . toHaveLength ( 1 ) ;
@@ -88,10 +90,80 @@ describe('cluster nodes endpoint', () => {
8890 } ) ;
8991 } ) ;
9092
93+ it ( 'get default nodes status of food db' , ( ) => {
94+ return client . cluster
95+ . nodesStatusGetter ( )
96+ . do ( )
97+ . then ( ( nodesStatusResponse : NodesStatusResponse ) => {
98+ expect ( nodesStatusResponse . nodes ) . toHaveLength ( 1 ) ;
99+ if ( nodesStatusResponse . nodes ) {
100+ const node = nodesStatusResponse . nodes [ 0 ] ;
101+ expect ( node . name ) . toMatch ( / .+ / ) ;
102+ expect ( node . version ) . toEqual ( EXPECTED_WEAVIATE_VERSION ) ;
103+ expect ( node . gitHash ) . toEqual ( EXPECTED_WEAVIATE_GIT_HASH ) ;
104+ expect ( node . status ) . toEqual ( 'HEALTHY' ) ;
105+ expect ( node . stats ?. objectCount ) . toEqual ( 6 ) ;
106+ expect ( node . stats ?. shardCount ) . toEqual ( 2 ) ;
107+ expect ( node . shards ) . toBeDefined ( ) ;
108+ expect ( node . shards ) . toHaveLength ( 2 ) ;
109+ if ( node . shards ) {
110+ expect ( [ node . shards [ 0 ] . class , node . shards [ 1 ] . class ] ) . toEqual (
111+ expect . arrayContaining ( [ PIZZA_CLASS_NAME , SOUP_CLASS_NAME ] )
112+ ) ;
113+ for ( let i = 0 ; i < node . shards . length ; i ++ ) {
114+ const shard = node . shards [ i ] ;
115+ expect ( shard . name ) . toMatch ( / .+ / ) ;
116+ switch ( shard . class ) {
117+ case PIZZA_CLASS_NAME :
118+ expect ( shard . objectCount ) . toEqual ( 4 ) ;
119+ break ;
120+ case SOUP_CLASS_NAME :
121+ expect ( shard . objectCount ) . toEqual ( 2 ) ;
122+ break ;
123+ }
124+ }
125+ } else {
126+ throw new Error ( 'node.shards should be defined' ) ;
127+ }
128+ } else {
129+ throw new Error ( 'nodesStatusResponse.nodes should be defined' ) ;
130+ }
131+ } )
132+ . catch ( ( e : any ) => {
133+ throw new Error ( 'should not fail on getting nodes: ' + e ) ;
134+ } ) ;
135+ } ) ;
136+
137+ it ( 'get minimal nodes status of food db' , ( ) => {
138+ return client . cluster
139+ . nodesStatusGetter ( )
140+ . withOutput ( 'minimal' )
141+ . do ( )
142+ . then ( ( nodesStatusResponse : NodesStatusResponse ) => {
143+ expect ( nodesStatusResponse . nodes ) . toHaveLength ( 1 ) ;
144+ if ( nodesStatusResponse . nodes ) {
145+ const node = nodesStatusResponse . nodes [ 0 ] ;
146+ expect ( node . name ) . toMatch ( / .+ / ) ;
147+ expect ( node . version ) . toEqual ( EXPECTED_WEAVIATE_VERSION ) ;
148+ expect ( node . gitHash ) . toEqual ( EXPECTED_WEAVIATE_GIT_HASH ) ;
149+ expect ( node . status ) . toEqual ( 'HEALTHY' ) ;
150+ expect ( node . stats ?. objectCount ) . toEqual ( 6 ) ;
151+ expect ( node . stats ?. shardCount ) . toEqual ( 2 ) ;
152+ expect ( node . shards ) . toBeNull ( ) ;
153+ } else {
154+ throw new Error ( 'nodesStatusResponse.nodes should be defined' ) ;
155+ }
156+ } )
157+ . catch ( ( e : any ) => {
158+ throw new Error ( 'should not fail on getting nodes: ' + e ) ;
159+ } ) ;
160+ } ) ;
161+
91162 it ( 'get nodes status of only Pizza class in food db' , ( ) => {
92163 return client . cluster
93164 . nodesStatusGetter ( )
94165 . withClassName ( PIZZA_CLASS_NAME )
166+ . withOutput ( 'verbose' )
95167 . do ( )
96168 . then ( ( nodesStatusResponse : NodesStatusResponse ) => {
97169 expect ( nodesStatusResponse . nodes ) . toBeDefined ( ) ;
0 commit comments