11import { GenericContainer , StartedTestContainer } from 'testcontainers' ;
22import weaviate from '..' ;
33import { WeaviateStartUpError } from '../errors' ;
4+ import { Meta } from '../openapi/types' ;
5+ import { DbVersion } from '../utils/dbVersion' ;
46
57describe ( 'Integration testing of the ConnectionGRPC class' , ( ) => {
68 let container : StartedTestContainer ;
9+
10+ const getVersion = ( ) =>
11+ fetch ( `http://${ container . getHost ( ) } :${ container . getMappedPort ( 8080 ) } /v1/meta` )
12+ . then ( ( res ) => res . json ( ) as Promise < Meta > )
13+ . then ( ( meta ) => DbVersion . fromString ( meta . version ! ) ) ;
14+
715 beforeAll ( async ( ) => {
816 container = await new GenericContainer ( `semitechnologies/weaviate:${ process . env . WEAVIATE_VERSION } ` )
917 . withExposedPorts ( 8080 , 50051 )
@@ -13,17 +21,20 @@ describe('Integration testing of the ConnectionGRPC class', () => {
1321 . start ( ) ;
1422 } ) ;
1523 it ( 'should fail to startup due to message-size limit' , async ( ) => {
24+ const dbVersion = await getVersion ( ) ;
1625 try {
1726 await weaviate . connectToLocal ( {
1827 host : container . getHost ( ) ,
1928 port : container . getMappedPort ( 8080 ) ,
2029 grpcPort : container . getMappedPort ( 50051 ) ,
2130 } ) ;
31+ expect ( dbVersion . isLowerThan ( 1 , 27 , 0 ) ) . toBe ( true ) ; // change to 1.27.1 when it lands
2232 } catch ( err ) {
2333 expect ( err ) . toBeInstanceOf ( WeaviateStartUpError ) ;
2434 expect ( ( err as WeaviateStartUpError ) . message ) . toContain (
2535 'RESOURCE_EXHAUSTED: Attempted to send message with a size larger than 1'
2636 ) ;
37+ expect ( dbVersion . isAtLeast ( 1 , 27 , 0 ) ) . toBe ( true ) ; // change to 1.27.1 when it lands
2738 }
2839 } ) ;
2940} ) ;
0 commit comments