Skip to content

Commit

Permalink
Update Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
huangpf committed Jun 6, 2017
1 parent bdacbac commit ec68c17
Show file tree
Hide file tree
Showing 3 changed files with 554 additions and 766 deletions.
42 changes: 41 additions & 1 deletion test/commands/cli.vm.initiate-maintenance-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ describe('cli', function () {
vmName, vmName, vmName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function (result) {
var check = ((result.exitStatus === 0) ||
(result.text.includes("The server encountered an internal error. Please retry the request.")) ||
(result.text.includes("User initiated maintenance on the Virtual Machine was successfully completed."))); // Depending on if the OS is new or old.
check.should.be.true;

Expand All @@ -101,7 +102,46 @@ describe('cli', function () {
var vmObj = JSON.parse(result.text);
vmObj.MaintenanceStatus.should.not.be.null;
result.exitStatus.should.equal(0);
done();

var cmd = util.format('compute virtual-machine get-remote-desktop-file --service-name %s --name %s --virtual-machine-name %s --json -vv',
vmName, vmName, vmName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function (result) {
var check = ((result.exitStatus !== 0) ||
(result.text.includes("An external endpoint to the Remote Desktop port (3389) must first be added to the role.")));
check.should.be.true;

var cmd = util.format('compute virtual-machine redeploy --service-name %s --name %s --virtual-machine-name %s --json -vv',
vmName, vmName, vmName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function (result) {
result.exitStatus.should.equal(0);

var cmd = util.format('compute virtual-machine restart --service-name %s --name %s --virtual-machine-name %s --json -vv',
vmName, vmName, vmName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function (result) {
result.exitStatus.should.equal(0);

var cmd = util.format('compute virtual-machine start --service-name %s --name %s --virtual-machine-name %s --json -vv',
vmName, vmName, vmName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function (result) {
result.exitStatus.should.equal(0);

var cmd = util.format('compute virtual-machine show --service-name %s --name %s --virtual-machine-name %s --json -vv',
vmName, vmName, vmName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function (result) {
result.exitStatus.should.equal(0);
var cmd = util.format('compute virtual-machine delete %s %s %s "" --json -vv',
vmName, vmName, vmName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function (result) {
var check = ((result.exitStatus !== 0) ||
(result.text.includes("Role " + vmName + "is the only role present in the deployment and so cannot be removed.")));
check.should.be.true;
done();
});
});
});
});
});
});
});
});
});
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ exports.getMockedProfile = function () {
var newProfile = new profile.Profile();

newProfile.addSubscription(new profile.Subscription({
id: 'ace9b607-25c7-4695-b94d-9bfc8fde73d9',
id: 'e33f361b-53c2-4cc7-b829-78906708387b',
managementCertificate: {
key: 'mockedKey',
cert: 'mockedCert'
},
name: 'Azure Test',
name: 'Microsoft Azure Internal Consumption',
registeredProviders: [],
_eventsCount: '1',
isDefault: true
Expand All @@ -21,9 +21,9 @@ exports.getMockedProfile = function () {
};

exports.setEnvironment = function() {
process.env['AZURE_VM_TEST_LOCATION'] = 'Central US EUAP';
process.env['AZURE_VM_TEST_LOCATION'] = 'South Central US';
};

exports.scopes = [];

exports.randomTestIdsGenerated = function() { return ['clitestvm777'];};
exports.randomTestIdsGenerated = function() { return ['clitestvm8336'];};

0 comments on commit ec68c17

Please sign in to comment.