@@ -408,6 +408,12 @@ public function testCreateFunctionAndDeploymentFromTemplate()
408408 $ this ->assertEquals (202 , $ deployment ['headers ' ]['status-code ' ]);
409409 $ this ->assertNotEmpty ($ deployment ['body ' ]['$id ' ]);
410410
411+ $ deployment = $ this ->getDeployment ($ functionId , $ deployment ['body ' ]['$id ' ]);
412+ $ this ->assertEquals (200 , $ deployment ['headers ' ]['status-code ' ]);
413+ $ this ->assertEquals (0 , $ deployment ['body ' ]['sourceSize ' ]);
414+ $ this ->assertEquals (0 , $ deployment ['body ' ]['buildSize ' ]);
415+ $ this ->assertEquals (0 , $ deployment ['body ' ]['totalSize ' ]);
416+
411417 $ deployments = $ this ->listDeployments ($ functionId );
412418
413419 $ this ->assertEquals (200 , $ deployments ['headers ' ]['status-code ' ]);
@@ -480,7 +486,14 @@ public function testCreateFunctionAndDeploymentFromTemplate()
480486 $ this ->assertStringContainsString ("Total users: " . $ totalUsers , $ execution ['body ' ]['logs ' ]);
481487 }, 10000 , 500 );
482488
483- $ function = $ this ->deleteFunction ($ functionId );
489+ $ deployment = $ this ->getDeployment ($ functionId , $ deployment ['body ' ]['$id ' ]);
490+ $ this ->assertEquals (200 , $ deployment ['headers ' ]['status-code ' ]);
491+ $ this ->assertGreaterThan (0 , $ deployment ['body ' ]['sourceSize ' ]);
492+ $ this ->assertGreaterThan (0 , $ deployment ['body ' ]['buildSize ' ]);
493+ $ totalSize = $ deployment ['body ' ]['sourceSize ' ] + $ deployment ['body ' ]['buildSize ' ];
494+ $ this ->assertEquals ($ totalSize , $ deployment ['body ' ]['totalSize ' ]);
495+
496+ $ function = $ this ->cleanupFunction ($ functionId );
484497 }
485498
486499 /**
@@ -1634,11 +1647,14 @@ public function testCookieExecution()
16341647 'entrypoint ' => 'index.php ' ,
16351648 'timeout ' => 15 ,
16361649 ]);
1637- $ this ->setupDeployment ($ functionId , [
1650+ $ this ->assertNotEmpty ($ functionId );
1651+
1652+ $ deploymentId = $ this ->setupDeployment ($ functionId , [
16381653 'entrypoint ' => 'index.php ' ,
16391654 'code ' => $ this ->packageFunction ('php-cookie ' ),
16401655 'activate ' => true
16411656 ]);
1657+ $ this ->assertNotEmpty ($ deploymentId );
16421658
16431659 $ cookie = 'cookieName=cookieValue; cookie2=value2; cookie3=value=3; cookie4=val:ue4; cookie5=value5 ' ;
16441660 $ execution = $ this ->createExecution ($ functionId , [
@@ -1654,6 +1670,13 @@ public function testCookieExecution()
16541670 $ this ->assertEquals ($ cookie , $ execution ['body ' ]['responseBody ' ]);
16551671 $ this ->assertGreaterThan (0 , $ execution ['body ' ]['duration ' ]);
16561672
1673+ $ deployment = $ this ->getDeployment ($ functionId , $ deploymentId );
1674+ $ this ->assertEquals (200 , $ deployment ['headers ' ]['status-code ' ]);
1675+ $ this ->assertGreaterThan (0 , $ deployment ['body ' ]['sourceSize ' ]);
1676+ $ this ->assertGreaterThan (0 , $ deployment ['body ' ]['buildSize ' ]);
1677+ $ totalSize = $ deployment ['body ' ]['sourceSize ' ] + $ deployment ['body ' ]['buildSize ' ];
1678+ $ this ->assertEquals ($ totalSize , $ deployment ['body ' ]['totalSize ' ]);
1679+
16571680 $ this ->cleanupFunction ($ functionId );
16581681 }
16591682
@@ -2029,13 +2052,34 @@ public function testDuplicateDeployment(): void
20292052 $ this ->assertEquals (200 , $ function ['headers ' ]['status-code ' ]);
20302053 $ this ->assertStringContainsString ('maintenance.js ' , $ function ['body ' ]['commands ' ]);
20312054
2032- $ deploymentId2 = $ this ->setupDuplicateDeployment ($ functionId , $ deploymentId1 );
2055+ $ deployment = $ this ->createDuplicateDeployment ($ functionId , $ deploymentId1 );
2056+ $ this ->assertEquals (202 , $ deployment ['headers ' ]['status-code ' ]);
2057+
2058+ $ deploymentId2 = $ deployment ['body ' ]['$id ' ];
20332059 $ this ->assertNotEmpty ($ deploymentId2 );
20342060
2061+ $ deployment = $ this ->getDeployment ($ functionId , $ deploymentId2 );
2062+ $ this ->assertEquals (200 , $ deployment ['headers ' ]['status-code ' ]);
2063+ $ this ->assertGreaterThan (0 , $ deployment ['body ' ]['sourceSize ' ]);
2064+ $ this ->assertEquals (0 , $ deployment ['body ' ]['buildSize ' ]);
2065+ $ this ->assertEquals ($ deployment ['body ' ]['sourceSize ' ], $ deployment ['body ' ]['totalSize ' ]);
2066+
2067+ $ this ->assertEventually (function () use ($ functionId , $ deploymentId2 ) {
2068+ $ function = $ this ->getFunction ($ functionId );
2069+ $ this ->assertEquals ($ deploymentId2 , $ function ['body ' ]['deploymentId ' ]);
2070+ }, 50000 , 500 );
2071+
20352072 $ execution = $ this ->createExecution ($ functionId );
20362073 $ this ->assertEquals (201 , $ execution ['headers ' ]['status-code ' ]);
20372074 $ this ->assertStringContainsString ('Maintenance ' , $ execution ['body ' ]['responseBody ' ]);
20382075
2076+ $ deployment = $ this ->getDeployment ($ functionId , $ deploymentId2 );
2077+ $ this ->assertEquals (200 , $ deployment ['headers ' ]['status-code ' ]);
2078+ $ this ->assertGreaterThan (0 , $ deployment ['body ' ]['sourceSize ' ]);
2079+ $ this ->assertGreaterThan (0 , $ deployment ['body ' ]['buildSize ' ]);
2080+ $ totalSize = $ deployment ['body ' ]['sourceSize ' ] + $ deployment ['body ' ]['buildSize ' ];
2081+ $ this ->assertEquals ($ totalSize , $ deployment ['body ' ]['totalSize ' ]);
2082+
20392083 $ this ->cleanupFunction ($ functionId );
20402084 }
20412085
0 commit comments