Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Add shared storage ut #4068

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as chai from 'chai';
import { cleanupUnitTest, prepareUnitTest } from '../../../../common/utils';
import chaiAsPromised = require("chai-as-promised");
import { AzureBlobSharedStorageService } from "../../../../training_service/reusable/shared_storages/azureblobStorageService";
import { AzureBlobConfig } from '../../../../common/experimentConfig';

describe('Unit Test for AzureBlobSharedstorage', () => {
let service: AzureBlobSharedStorageService;
let testAzureBlobConfig: AzureBlobConfig = JSON.parse(
"{\"storageType\": \"AzureBlob\",\"localMountPoint\": \"localMountPoint\",\"remoteMountPoint\": \"remoteMountPoint\",\"localMounted\":\"localMounted\",\"storageAccountName\":\"storageAccountName\",\"storageAccountKey\":\"storageAccountKey\",\"containerName\":\"containerName\"}");

before(() => {
chai.should();
chai.use(chaiAsPromised);
prepareUnitTest();
service = new AzureBlobSharedStorageService();
service.config(testAzureBlobConfig);
});

after(() => {
cleanupUnitTest();
});

it('test azureblobStorageService canLocalMounted', async () => {
chai.expect(service.canLocalMounted).to.be.true;
});

it('test azureblobStorageService localMountCommand', async () => {
let serviceLocal: AzureBlobSharedStorageService;
serviceLocal = new AzureBlobSharedStorageService();
chai.expect(serviceLocal.localMountCommand).to.be.equal('');

await serviceLocal.config(testAzureBlobConfig)
chai.expect(serviceLocal.localMountCommand).to.not.be.equal('');
});

it('test azureblobStorageService storageService', async () => {
chai.expect(service.storageService).to.not.be.equal(undefined);
});

it('test azureblobStorageService remoteMountCommand', async () => {
let serviceLocal: AzureBlobSharedStorageService;
serviceLocal = new AzureBlobSharedStorageService();
chai.expect(serviceLocal.remoteMountCommand).to.be.equal('');

await serviceLocal.config(testAzureBlobConfig)
chai.expect(serviceLocal.remoteMountCommand).to.not.be.equal('');
});

it('test azureblobStorageService remoteUmountCommand', async () => {
let serviceLocal: AzureBlobSharedStorageService;
serviceLocal = new AzureBlobSharedStorageService();
chai.expect(serviceLocal.remoteUmountCommand).to.be.equal('');

await serviceLocal.config(testAzureBlobConfig)
chai.expect(serviceLocal.remoteUmountCommand).to.not.be.equal('');
});

it('test azureblobStorageService localWorkingRoot', async () => {
chai.expect(service.localWorkingRoot).to.not.be.equal('');
});

it('test azureblobStorageService remoteWorkingRoot', async () => {
chai.expect(service.remoteWorkingRoot).to.not.be.equal('');
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import * as chai from 'chai';
import { cleanupUnitTest, prepareUnitTest } from '../../../../common/utils';
import chaiAsPromised = require("chai-as-promised");
import { NFSSharedStorageService } from "../../../../training_service/reusable/shared_storages/nfsStorageService";
import { NfsConfig } from '../../../../common/experimentConfig';

describe('Unit Test for NFSSharedstorage', () => {
let service: NFSSharedStorageService;
let testNFSConfig: NfsConfig = JSON.parse(
"{\"storageType\": \"NFS\",\"localMountPoint\": \"localMountPoint\",\"remoteMountPoint\": \"remoteMountPoint\",\"localMounted\":\"localMounted\",\"nfsServer\":\"nfsServer\",\"exportedDirectory\":\"exportedDirectory\"}");

before(() => {
chai.should();
chai.use(chaiAsPromised);
prepareUnitTest();
service = new NFSSharedStorageService();
service.config(testNFSConfig);
});

after(() => {
cleanupUnitTest();
});

it('test nfsStorageService canLocalMounted', async () => {
chai.expect(service.canLocalMounted).to.be.true;
});

it('test nfsStorageService localMountCommand', async () => {
let serviceLocal: NFSSharedStorageService;
serviceLocal = new NFSSharedStorageService();
chai.expect(serviceLocal.localMountCommand).to.be.equal('');

await serviceLocal.config(testNFSConfig)
chai.expect(serviceLocal.localMountCommand).to.not.be.equal('');
});

it('test nfsStorageService storageService', async () => {
chai.expect(service.storageService).to.not.be.equal(undefined);
});

it('test nfsStorageService remoteMountCommand', async () => {
let serviceLocal: NFSSharedStorageService;
serviceLocal = new NFSSharedStorageService();
chai.expect(serviceLocal.remoteMountCommand).to.be.equal('');

await serviceLocal.config(testNFSConfig)
chai.expect(serviceLocal.remoteMountCommand).to.not.be.equal('');
});

it('test nfsStorageService remoteUmountCommand', async () => {
let serviceLocal: NFSSharedStorageService;
serviceLocal = new NFSSharedStorageService();
chai.expect(serviceLocal.remoteUmountCommand).to.be.equal('');

await serviceLocal.config(testNFSConfig)
chai.expect(serviceLocal.remoteUmountCommand).to.not.be.equal('');
});

it('test nfsStorageService localWorkingRoot', async () => {
chai.expect(service.localWorkingRoot).to.not.be.equal('');
});

it('test nfsStorageService remoteWorkingRoot', async () => {
chai.expect(service.remoteWorkingRoot).to.not.be.equal('');
});
});