@@ -11,7 +11,7 @@ describe("GenericContainer resources quota", { timeout: 180_000 }, () => {
1111 if ( ! process . env [ "CI_ROOTLESS" ] ) {
1212 it ( "should set resources quota" , async ( ) => {
1313 await using container = await new GenericContainer ( "cristianrgreco/testcontainer:1.1.14" )
14- . withResourcesQuota ( { memory : 0.5 , cpu : 1 } )
14+ . withResourcesQuota ( { cpu : 1 , memory : 0.5 } )
1515 . start ( ) ;
1616
1717 const dockerContainer = await client . container . getById ( container . getId ( ) ) ;
@@ -44,6 +44,20 @@ describe("GenericContainer resources quota", { timeout: 180_000 }, () => {
4444 expect ( containerInfo . HostConfig . NanoCpus ) . toEqual ( 0 ) ;
4545 } ) ;
4646
47+ if ( ! process . env [ "CI_ROOTLESS" ] ) {
48+ it ( "should round values to match target int64 type" , async ( ) => {
49+ await using container = await new GenericContainer ( "cristianrgreco/testcontainer:1.1.14" )
50+ . withResourcesQuota ( { cpu : 0.3 , memory : 0.2 } )
51+ . start ( ) ;
52+
53+ const dockerContainer = await client . container . getById ( container . getId ( ) ) ;
54+ const containerInfo = await dockerContainer . inspect ( ) ;
55+
56+ expect ( containerInfo . HostConfig . Memory ) . toEqual ( 214748365 ) ;
57+ expect ( containerInfo . HostConfig . NanoCpus ) . toEqual ( 300000000 ) ;
58+ } ) ;
59+ }
60+
4761 if ( ! process . env [ "CI_ROOTLESS" ] ) {
4862 it ( "should set resources quota cpu only, memory should be 0" , async ( ) => {
4963 await using container = await new GenericContainer ( "cristianrgreco/testcontainer:1.1.14" )
0 commit comments