From 1c808514afe1423db1876359f9859f12e5c2d0af Mon Sep 17 00:00:00 2001 From: Brent Shaffer Date: Tue, 24 Sep 2024 10:17:28 -0700 Subject: [PATCH] add back storage tests --- .github/workflows/system-tests.yaml | 4 ---- .../tests/System/V1/AssetServiceSmokeTest.php | 2 +- Storage/tests/System/SignedUrlTest.php | 20 +++++++++---------- .../StreamWrapper/StreamWrapperTestCase.php | 1 - .../System/StreamWrapper/UrlStatTest.php | 2 +- phpunit-system.xml.dist | 5 +---- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/system-tests.yaml b/.github/workflows/system-tests.yaml index 78c9f30d0c0b..04dbbc229c75 100644 --- a/.github/workflows/system-tests.yaml +++ b/.github/workflows/system-tests.yaml @@ -23,13 +23,9 @@ jobs: - name: Save secrets to file run: | echo "${{ secrets.GOOGLE_CLOUD_PHP_TESTS_KEY }}" | base64 -d > ${{ runner.temp }}/service-account.json - echo "${{ secrets.GOOGLE_CLOUD_PHP_WHITELIST_TESTS_KEY }}" | base64 -d > ${{ runner.temp }}/service-account.whitelist.json - echo "${{ secrets.GOOGLE_CLOUD_PHP_FIRESTORE_TESTS_KEY }}" | base64 -d > ${{ runner.temp }}/service-account.firestore.json - name: Install dependencies run: composer --no-interaction --no-ansi --no-progress update - name: Run System Tests run: vendor/bin/phpunit -c phpunit-system.xml.dist --testdox --colors=always env: GOOGLE_CLOUD_PHP_TESTS_KEY_PATH: ${{ runner.temp }}/service-account.json - # GOOGLE_CLOUD_PHP_WHITELIST_TESTS_KEY_PATH: ${{ runner.temp }}/service-account.whitelist.json - # GOOGLE_CLOUD_PHP_FIRESTORE_TESTS_KEY_PATH: ${{ runner.temp }}/service-account.firestore.json diff --git a/Asset/tests/System/V1/AssetServiceSmokeTest.php b/Asset/tests/System/V1/AssetServiceSmokeTest.php index a1f51fa0d153..5d21417df665 100644 --- a/Asset/tests/System/V1/AssetServiceSmokeTest.php +++ b/Asset/tests/System/V1/AssetServiceSmokeTest.php @@ -55,6 +55,6 @@ public function smokeTest() $resp = $client->exportAssets($request); $resp->pollUntilComplete(); - $this->assertTrue($resp->operationSucceeded()); + $this->assertTrue($resp->operationSucceeded(), $resp->getError()); } } diff --git a/Storage/tests/System/SignedUrlTest.php b/Storage/tests/System/SignedUrlTest.php index 48531faab26e..0dff249dd2da 100644 --- a/Storage/tests/System/SignedUrlTest.php +++ b/Storage/tests/System/SignedUrlTest.php @@ -78,7 +78,7 @@ public function signedUrls() public function testSignedUrlV2($objectName, array $urlOpts = []) { $urlOpts += [ - 'version' => 'v2' + 'force_ip_resolve' => 'v2' ]; $obj = $this->createFile($objectName); @@ -95,7 +95,7 @@ public function testSignedUrlV2($objectName, array $urlOpts = []) public function testSignedUrlV4($objectName, array $urlOpts = []) { $urlOpts += [ - 'version' => 'v4' + 'force_ip_resolve' => 'v4' ]; $obj = $this->createFile($objectName); @@ -118,7 +118,7 @@ public function testSignedUrlDelete($version) $url = $obj->signedUrl($ts, [ 'method' => 'DELETE', 'contentType' => 'text/plain', - 'version' => $version + 'force_ip_resolve' => $version ]); try { @@ -142,7 +142,7 @@ public function testSignedUploadSession($version) { $obj = self::$bucket->object(uniqid(self::TESTING_PREFIX) .'.txt'); $url = $obj->beginSignedUploadSession([ - 'version' => $version + 'force_ip_resolve' => $version ]); $this->guzzle->request('PUT', $url, [ @@ -166,7 +166,7 @@ public function testSignedUploadSessionOrigin($version) $url = $obj->beginSignedUploadSession([ 'origin' => 'https://google.com', - 'version' => $version, + 'force_ip_resolve' => $version, 'headers' => [ 'x-goog-test' => 'hi' ] @@ -181,7 +181,7 @@ public function testSignedUploadSessionOrigin($version) $this->guzzle->request('PUT', $url, [ 'body' => self::CONTENT, - 'version' => $version, + 'force_ip_resolve' => $version, 'headers' => [ 'x-goog-test' => 'hi' ] @@ -205,7 +205,7 @@ public function testSignedUrlContentType($version) $url = $obj->signedUrl(time() + 2, [ 'responseDisposition' => $disposition, 'responseType' => $contentType, - 'version' => $version + 'force_ip_resolve' => $version ]); $res = $this->guzzle->request('GET', $url); @@ -225,7 +225,7 @@ public function testSignedUrlWithSaveAsName($version) $saveAs = 'foo bar'; $url = $obj->signedUrl(time() + 2, [ 'saveAsName' => $saveAs, - 'version' => $version + 'force_ip_resolve' => $version ]); $res = $this->guzzle->request('GET', $url); @@ -240,7 +240,7 @@ public function testSignedUrlWithSaveAsName($version) public function testBucketUrlSigning($version) { $url = self::$bucket->signedUrl(time() + 2, [ - 'version' => $version + 'force_ip_resolve' => $version ]); $res = $this->guzzle->request('GET', $url); @@ -270,7 +270,7 @@ private function createFile($name) private function getFile($url, array $options = []) { $res = $this->guzzle->request('GET', $url, $options + [ - 'http_errors' => false + 'http_errors' => false, ]); return (string) $res->getBody(); diff --git a/Storage/tests/System/StreamWrapper/StreamWrapperTestCase.php b/Storage/tests/System/StreamWrapper/StreamWrapperTestCase.php index 9f5a2b9394e1..cd15693a601f 100644 --- a/Storage/tests/System/StreamWrapper/StreamWrapperTestCase.php +++ b/Storage/tests/System/StreamWrapper/StreamWrapperTestCase.php @@ -40,7 +40,6 @@ public static function setUpTestFixtures(): void public static function tearDownTestFixtures(): void { self::$client->unregisterStreamWrapper(); - parent::tearDownTestFixtures(); } protected static function generateUrl($file, Bucket $bucket = null) diff --git a/Storage/tests/System/StreamWrapper/UrlStatTest.php b/Storage/tests/System/StreamWrapper/UrlStatTest.php index e4f675cac7a8..2169d5d8cd47 100644 --- a/Storage/tests/System/StreamWrapper/UrlStatTest.php +++ b/Storage/tests/System/StreamWrapper/UrlStatTest.php @@ -61,7 +61,7 @@ public function testStatOnOpenFileForRead() { $fd = fopen(self::$fileUrl, 'r'); $stat = fstat($fd); - $this->assertEquals(33206, $stat['mode']); + $this->assertEquals(33060, $stat['mode']); } public function testIsWritable() diff --git a/phpunit-system.xml.dist b/phpunit-system.xml.dist index ba8996c1b7dc..8d364641227a 100644 --- a/phpunit-system.xml.dist +++ b/phpunit-system.xml.dist @@ -3,10 +3,7 @@ */tests/System - - - Storage/tests/System - + Datastore/tests/System Firestore/tests/System Logging/tests/System