-
Notifications
You must be signed in to change notification settings - Fork 902
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
85 changed files
with
2,272 additions
and
932 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
Improve error messages when using alpha features without being in the alpha program (#4354) | ||
- Improve error messages when using alpha features without being in the alpha program (#4354) | ||
- Fixes bug where resumable uploads were not setting custom metadata on upload (#3398). | ||
- Fixes bug where GCS metadataUpdate cloud functions were triggered in incorrect situations (#3398). | ||
- Fixes bug where quoted escape sequences in .env files were incompletely unescaped. (#4270) | ||
- Fixes Storage Emulator ruleset file watcher (#4337). | ||
- Fixes issue with importing Storage Emulator data exported prior to v10.3.0 (#4358). | ||
- Adds ergonomic improvements to CF3 secret commands to automatically redeploy functions and delete unused secrets (#4130). | ||
- Fixes issue with alpha users setting timeouts (#4381) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...storage-emulator-integration/import/flattened-emulator-data/firebase-export-metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"version": "10.4.2", | ||
"storage": { | ||
"version": "10.4.2", | ||
"path": "storage_export" | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
...s/storage-emulator-integration/import/flattened-emulator-data/storage_export/buckets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"buckets": [ | ||
{ | ||
"id": "fake-project-id.appspot.com" | ||
} | ||
] | ||
} |
20 changes: 20 additions & 0 deletions
20
...-emulator-data/storage_export/metadata/fake-project-id.appspot.com%2Ftest_upload.jpg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "test_upload.jpg", | ||
"bucket": "fake-project-id.appspot.com", | ||
"contentType": "application/octet-stream", | ||
"metageneration": 1, | ||
"generation": 1648084940926, | ||
"storageClass": "STANDARD", | ||
"contentDisposition": "inline", | ||
"cacheControl": "public, max-age=3600", | ||
"contentEncoding": "identity", | ||
"downloadTokens": [ | ||
"c3c71086-95a8-445d-96e7-f625972de4b0" | ||
], | ||
"etag": "PQJQBXRweACX9yRsBEInQjOJ/0s", | ||
"timeCreated": "2022-03-24T01:22:20.926Z", | ||
"updated": "2022-03-24T01:22:20.926Z", | ||
"size": 0, | ||
"md5Hash": "1B2M2Y8AsgTpgAmY7PhCfg==", | ||
"crc32c": "0" | ||
} |
7 changes: 7 additions & 0 deletions
7
...ts/storage-emulator-integration/import/nested-emulator-data/firebase-export-metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"version": "10.4.2", | ||
"storage": { | ||
"version": "10.4.2", | ||
"path": "storage_export" | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
scripts/storage-emulator-integration/import/nested-emulator-data/storage_export/buckets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"buckets": [ | ||
{ | ||
"id": "fake-project-id.appspot.com" | ||
} | ||
] | ||
} |
20 changes: 20 additions & 0 deletions
20
...ed-emulator-data/storage_export/metadata/fake-project-id.appspot.com/test_upload.jpg.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "test_upload.jpg", | ||
"bucket": "fake-project-id.appspot.com", | ||
"contentType": "application/octet-stream", | ||
"metageneration": 1, | ||
"generation": 1648084940926, | ||
"storageClass": "STANDARD", | ||
"contentDisposition": "inline", | ||
"cacheControl": "public, max-age=3600", | ||
"contentEncoding": "identity", | ||
"downloadTokens": [ | ||
"c3c71086-95a8-445d-96e7-f625972de4b0" | ||
], | ||
"etag": "PQJQBXRweACX9yRsBEInQjOJ/0s", | ||
"timeCreated": "2022-03-24T01:22:20.926Z", | ||
"updated": "2022-03-24T01:22:20.926Z", | ||
"size": 0, | ||
"md5Hash": "1B2M2Y8AsgTpgAmY7PhCfg==", | ||
"crc32c": "0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import * as path from "path"; | ||
import * as fs from "fs-extra"; | ||
import { expect } from "chai"; | ||
import supertest = require("supertest"); | ||
|
||
import { createTmpDir } from "../../../src/test/emulators/fixtures"; | ||
import { Emulators } from "../../../src/emulator/types"; | ||
import { TriggerEndToEndTest } from "../../integration-helpers/framework"; | ||
import { | ||
EMULATORS_SHUTDOWN_DELAY_MS, | ||
FIREBASE_EMULATOR_CONFIG, | ||
getStorageEmulatorHost, | ||
readEmulatorConfig, | ||
TEST_SETUP_TIMEOUT, | ||
} from "../utils"; | ||
|
||
describe("Import Emulator Data", () => { | ||
const FIREBASE_PROJECT = "fake-project-id"; | ||
const BUCKET = `${FIREBASE_PROJECT}.appspot.com`; | ||
const EMULATOR_CONFIG = readEmulatorConfig(FIREBASE_EMULATOR_CONFIG); | ||
const STORAGE_EMULATOR_HOST = getStorageEmulatorHost(EMULATOR_CONFIG); | ||
const test = new TriggerEndToEndTest(FIREBASE_PROJECT, __dirname, EMULATOR_CONFIG); | ||
|
||
it("retrieves file from imported flattened emulator data", async function (this) { | ||
this.timeout(TEST_SETUP_TIMEOUT); | ||
await test.startEmulators([ | ||
"--only", | ||
Emulators.STORAGE, | ||
"--import", | ||
path.join(__dirname, "flattened-emulator-data"), | ||
]); | ||
|
||
await supertest(STORAGE_EMULATOR_HOST) | ||
.get(`/v0/b/${BUCKET}/o/test_upload.jpg`) | ||
.set({ Authorization: "Bearer owner" }) | ||
.expect(200); | ||
}); | ||
|
||
it("stores only the files as blobs when importing emulator data", async function (this) { | ||
this.timeout(TEST_SETUP_TIMEOUT); | ||
const exportedData = createTmpDir("exported-emulator-data"); | ||
|
||
// Import data and export it again on exit | ||
await test.startEmulators([ | ||
"--only", | ||
Emulators.STORAGE, | ||
"--import", | ||
path.join(__dirname, "nested-emulator-data"), | ||
"--export-on-exit", | ||
exportedData, | ||
]); | ||
await test.stopEmulators(); | ||
|
||
expect(fs.readdirSync(path.join(exportedData, "storage_export", "blobs")).length).to.equal(1); | ||
expect(fs.readdirSync(path.join(exportedData, "storage_export", "blobs"))[0]).to.equal( | ||
encodeURIComponent(`${BUCKET}/test_upload.jpg`) | ||
); | ||
}); | ||
|
||
it("retrieves file from imported nested emulator data", async function (this) { | ||
this.timeout(TEST_SETUP_TIMEOUT); | ||
await test.startEmulators([ | ||
"--only", | ||
Emulators.STORAGE, | ||
"--import", | ||
path.join(__dirname, "nested-emulator-data"), | ||
]); | ||
|
||
await supertest(STORAGE_EMULATOR_HOST) | ||
.get(`/v0/b/${BUCKET}/o/test_upload.jpg`) | ||
.set({ Authorization: "Bearer owner" }) | ||
.expect(200); | ||
}); | ||
|
||
it("retrieves file from importing previously exported emulator data", async function (this) { | ||
this.timeout(TEST_SETUP_TIMEOUT); | ||
const exportedData = createTmpDir("exported-emulator-data"); | ||
|
||
// Upload file to Storage and export emulator data to tmp directory | ||
await test.startEmulators(["--only", Emulators.STORAGE, "--export-on-exit", exportedData]); | ||
const uploadURL = await supertest(STORAGE_EMULATOR_HOST) | ||
.post(`/v0/b/${BUCKET}/o/test_upload.jpg?uploadType=resumable&name=test_upload.jpg`) | ||
.set({ | ||
Authorization: "Bearer owner", | ||
"X-Goog-Upload-Protocol": "resumable", | ||
"X-Goog-Upload-Command": "start", | ||
}) | ||
.then((res) => new URL(res.header["x-goog-upload-url"])); | ||
|
||
await supertest(STORAGE_EMULATOR_HOST) | ||
.put(uploadURL.pathname + uploadURL.search) | ||
.set({ | ||
"X-Goog-Upload-Protocol": "resumable", | ||
"X-Goog-Upload-Command": "upload, finalize", | ||
}); | ||
|
||
await test.stopEmulators(); | ||
|
||
// Import previously exported emulator data and retrieve file from Storage | ||
await test.startEmulators(["--only", Emulators.STORAGE, "--import", exportedData]); | ||
await supertest(STORAGE_EMULATOR_HOST) | ||
.get(`/v0/b/${BUCKET}/o/test_upload.jpg`) | ||
.set({ Authorization: "Bearer owner" }) | ||
.expect(200); | ||
}); | ||
|
||
afterEach(async function (this) { | ||
this.timeout(EMULATORS_SHUTDOWN_DELAY_MS); | ||
await test.stopEmulators(); | ||
}); | ||
}); |
Oops, something went wrong.