Skip to content

Commit a14db08

Browse files
author
Aaron Dabney
committed
removed large file
Signed-off-by: Aaron Dabney <aaron.g.dabney@gmail.com>
1 parent ae21157 commit a14db08

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

lib/common/tests/node-request-generator.spec.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ describe("Test Request Generator ", () => {
3333
? `${clientInfo} (${os.platform}/${os.release}; Node/${process.version}) ${appendUserAgent}`
3434
: `${clientInfo} (${os.platform}/${os.release}; Node/${process.version})`;
3535

36+
const testFilePath = __dirname + "/resources/test_file.bin";
37+
const largeString = "a".repeat(10485760);
38+
39+
before(() => {
40+
fs.writeFileSync(testFilePath, largeString);
41+
});
42+
3643
it("should compose request properly in Node environment", async function() {
3744
const sdkRequest = await composeRequest({
3845
baseEndpoint: "http://test-end-point/20191002",
@@ -61,9 +68,9 @@ describe("Test Request Generator ", () => {
6168
"Content-Length": undefined,
6269
"opc-retry-token": undefined
6370
};
64-
const fileLocation = __dirname + "/resources/large_file.bin";
65-
const objectData = await fs.createReadStream(fileLocation);
66-
const size = fs.statSync(fileLocation).size;
71+
72+
const objectData = await fs.createReadStream(testFilePath);
73+
const size = fs.statSync(testFilePath).size;
6774
const sdkRequest = await composeRequest({
6875
baseEndpoint: "http://test-end-point/20191002",
6976
defaultHeaders: {},
@@ -95,9 +102,9 @@ describe("Test Request Generator ", () => {
95102
"Content-Length": undefined,
96103
"opc-retry-token": undefined
97104
};
98-
const fileLocation = __dirname + "/resources/large_file.bin";
99-
const size = fs.statSync(fileLocation).size;
100-
const objectData = await fs.createReadStream(fileLocation);
105+
106+
const size = fs.statSync(testFilePath).size;
107+
const objectData = await fs.createReadStream(testFilePath);
101108
objectData.path = ""; // Force the path to be an empty string
102109
const sdkRequest = await composeRequest({
103110
baseEndpoint: "http://test-end-point/20191002",
@@ -193,4 +200,10 @@ describe("Test Request Generator ", () => {
193200
"http://test-end-point/20191002/testUrl/Test-Id/actions?imageId=test&definedTagEquals=namespace1.key.val&definedTagEquals=namespace1.key.val2&definedTagEquals=namespace2.key.val&freeformTagEquals=ff1key.val&freeformTagEquals=ff2key.val"
194201
);
195202
});
203+
204+
after(() => {
205+
// if (fs.existsSync(testFilePath)) {
206+
// fs.rmSync(testFilePath);
207+
// }
208+
});
196209
});

lib/common/tests/resources/large_file.bin

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)