Skip to content

Commit

Permalink
SMB multichannel test only
Browse files Browse the repository at this point in the history
  • Loading branch information
doxiaodong committed Sep 10, 2020
1 parent 8700fd7 commit ac983a2
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 12 deletions.
2 changes: 2 additions & 0 deletions sdk/storage/storage-file-share/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ module.exports = function(config) {
"ACCOUNT_SAS",
"SOFT_DELETE_ACCOUNT_NAME",
"SOFT_DELETE_ACCOUNT_SAS",
"PREMIUM_FILE_ACCOUNT_NAME",
"PREMIUM_FILE_ACCOUNT_SAS",
"TEST_MODE"
],

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions sdk/storage/storage-file-share/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,14 @@ DIR_NAME=<directory name>
# change it to "record" to generate new recordings, or "live" to bypass the recorder entirely.
# TEST_MODE=playback

# Used for share soft delete.
# Optional, used for share soft delete.
SOFT_DELETE_ACCOUNT_NAME=<storage-account-name>
SOFT_DELETE_ACCOUNT_KEY=<storage-account-key>
SOFT_DELETE_STORAGE_CONNECTION_STRING=<storage-account-connection-string>
SOFT_DELETE_ACCOUNT_SAS=<shared-access-signature>
SOFT_DELETE_ACCOUNT_SAS=<shared-access-signature>

# Optional, used for tests on premium file accounts.
PREMIUM_FILE_ACCOUNT_NAME=<storage-account-name>
PREMIUM_FILE_ACCOUNT_KEY=<storage-account-key>
PREMIUM_FILE_STORAGE_CONNECTION_STRING=<storage-account-connection-string>
PREMIUM_FILE_ACCOUNT_SAS=<shared-access-signature>
44 changes: 35 additions & 9 deletions sdk/storage/storage-file-share/test/fileserviceclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
getBSU,
getSASConnectionStringFromEnvironment,
recorderEnvSetup,
getSoftDeleteBSU
getSoftDeleteBSU,
getGenericBSU
} from "./utils";
import { record, delay, Recorder } from "@azure/test-utils-recorder";
import * as dotenv from "dotenv";
Expand All @@ -14,11 +15,11 @@ dotenv.config();
describe("FileServiceClient", () => {
let recorder: Recorder;

beforeEach(function () {
beforeEach(function() {
recorder = record(this, recorderEnvSetup);
});

afterEach(async function () {
afterEach(async function() {
await recorder.stop();
});

Expand Down Expand Up @@ -387,12 +388,11 @@ describe("FileServiceClient", () => {
});
});


describe("FileServiceClient", () => {
let recorder: Recorder;
let serviceClient: ShareServiceClient;

beforeEach(function () {
beforeEach(function() {
recorder = record(this, recorderEnvSetup);

try {
Expand All @@ -402,11 +402,11 @@ describe("FileServiceClient", () => {
}
});

afterEach(async function () {
afterEach(async function() {
await recorder.stop();
});

it("ListShares with deleted share", async function () {
it("ListShares with deleted share", async function() {
const shareClient = serviceClient.getShareClient(recorder.getUniqueName("share"));
await shareClient.create();
await shareClient.delete();
Expand All @@ -422,7 +422,7 @@ describe("FileServiceClient", () => {
assert.ok(found);
});

it("Undelete share positive", async function () {
it("Undelete share positive", async function() {
const shareClient = serviceClient.getShareClient(recorder.getUniqueName("share"));
await shareClient.create();
await shareClient.delete();
Expand Down Expand Up @@ -455,7 +455,7 @@ describe("FileServiceClient", () => {
await restoredShareClient.delete();
});

it("Undelete share negative", async function () {
it("Undelete share negative", async function() {
const shareClient = serviceClient.getShareClient(recorder.getUniqueName("share"));
const invalidVersion = "01D60F8BB59A4652";

Expand All @@ -467,3 +467,29 @@ describe("FileServiceClient", () => {
}
});
});

describe("FileServiceClient Premium", () => {
let recorder: Recorder;
let serviceClient: ShareServiceClient;

beforeEach(function() {
recorder = record(this, recorderEnvSetup);
try {
serviceClient = getGenericBSU("PREMIUM_FILE_");
} catch (error) {
this.skip();
}
});

afterEach(async function() {
await recorder.stop();
});

it("SMB Multichannel", async () => {
await serviceClient.setProperties({
protocolSettings: { smbSettings: { multichannel: { enabled: true } } }
});
const propertiesSet = await serviceClient.getProperties();
assert.ok(propertiesSet.protocolSettings?.smbSettings?.multichannel);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export function isBrowser(): boolean {
const mockAccountName = "fakestorageaccount";
const mockAccountKey = "aaaaa";
const mockSDAccountName = "sd-fakestorageaccount";
const mockPFAccountName = "pf-fakestorageaccount";
export const recorderEnvSetup: RecorderEnvironmentSetup = {
replaceableVariables: {
// Used in record and playback modes
Expand All @@ -23,7 +24,11 @@ export const recorderEnvSetup: RecorderEnvironmentSetup = {
SOFT_DELETE_ACCOUNT_NAME: `${mockSDAccountName}`,
SOFT_DELETE_ACCOUNT_KEY: `${mockAccountKey}`,
SOFT_DELETE_ACCOUNT_SAS: `${mockAccountKey}`,
SOFT_DELETE_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockSDAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net`
SOFT_DELETE_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockSDAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net`,
PREMIUM_FILE_ACCOUNT_NAME: `${mockPFAccountName}`,
PREMIUM_FILE_ACCOUNT_KEY: `${mockAccountKey}`,
PREMIUM_FILE_ACCOUNT_SAS: `${mockAccountKey}`,
PREMIUM_FILE_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockPFAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net`
},
customizationsOnRecordings: [
// Used in record mode
Expand Down

0 comments on commit ac983a2

Please sign in to comment.