Skip to content

Commit

Permalink
Add console logging to debug CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
tohhsinpei committed Mar 25, 2022
1 parent 3d5a0d4 commit 62a5632
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scripts/storage-emulator-integration/import/tests.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as path from "path";
import supertest = require("supertest");
import { Emulators } from "../../../src/emulator/types";
import { TriggerEndToEndTest } from "../../integration-helpers/framework";
Expand All @@ -9,9 +10,8 @@ import {
TEST_SETUP_TIMEOUT,
} from "../utils";

const FIREBASE_PROJECT = process.env.FBTOOLS_TARGET_PROJECT || "fake-project-id";

describe("Import Emulator Data", () => {
const FIREBASE_PROJECT = "fake-project-id";
const bucket = `${FIREBASE_PROJECT}.appspot.com`;
const emulatorConfig = readEmulatorConfig(FIREBASE_EMULATOR_CONFIG);
const STORAGE_EMULATOR_HOST = getStorageEmulatorHost(emulatorConfig);
Expand All @@ -22,7 +22,8 @@ describe("Import Emulator Data", () => {
await test.startEmulators([
"--only",
Emulators.STORAGE,
`--import=${__dirname}/flattened-emulator-data`,
"--import",
path.join(__dirname, "flattened-emulator-data"),
]);

await supertest(STORAGE_EMULATOR_HOST)
Expand All @@ -33,7 +34,12 @@ describe("Import Emulator Data", () => {

it("retrieves file from imported nested emulator data", async function (this) {
this.timeout(TEST_SETUP_TIMEOUT);
await test.startEmulators(["--only", Emulators.STORAGE, "--import=./nested-emulator-data"]);
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`)
Expand Down
7 changes: 7 additions & 0 deletions src/emulator/storage/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,13 @@ export class StorageLayer {
const key = this.path(bucket, object);
const val = this._files.get(key);

console.log(`bucket: ${bucket}, object: ${object}, key: ${key}`);
console.log("this._files:");
Array.from(this._files.keys()).forEach((key) =>
console.log(`${key}: ${this._files.get(key)?.path}`)
);
// console.log(`this._files.entries(): ${[...this._files.entries()]}`);

if (val) {
return val.metadata;
}
Expand Down

0 comments on commit 62a5632

Please sign in to comment.