Skip to content

Commit

Permalink
Fix Compute Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
huangpf committed Jan 30, 2017
1 parent 0b63c7c commit 78c72f8
Show file tree
Hide file tree
Showing 151 changed files with 68,556 additions and 25,010 deletions.
8 changes: 4 additions & 4 deletions lib/commands/arm/acs/acs._js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ exports.init = function (cli) {
cli.output.verbose('new-agent-count = ' + newAgentCount);
var subscription = profile.current.getSubscription(options.subscription);
var computeManagementClient = utils.createComputeManagementClient(subscription);
var acs = computeManagementClient.containerServiceOperations.get(resourceGroup, name, _);
if(newAgentCount == acs.agentPoolProfiles[0].count){
var acs = computeManagementClient.containerServices.get(resourceGroup, name, _);
if (newAgentCount == acs.agentPoolProfiles[0].count){
throw new Error('New agent count should be greater than existing count.');
}
acs.agentPoolProfiles[0].count = parseInt(newAgentCount);
var result = computeManagementClient.containerServiceOperations.createOrUpdate(resourceGroup, name, acs , _);
acs.agentPoolProfiles[0].count = parseInt(newAgentCount);
var result = computeManagementClient.containerServices.createOrUpdate(resourceGroup, name, acs , _);
if (result) {
cli.output.json(result);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/arm/vmss/vmss._js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ exports.init = function (cli) {
var parametersObj = {
name : options.name,
location : options.location,
overProvision : false,
overprovision : false,
sku : {
capacity : options.skuCapacity,
name : options.skuName,
Expand Down
52 changes: 35 additions & 17 deletions test/commands/arm/container/arm.container-parameter-create-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('arm', function() {
var cmd = makeCommandStr('container-service', 'set', paramFileName, util.format('--name %s --location %s', containerPrefix, location)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('container-service', 'delete', paramFileName, util.format('--diagnostics-profile --windows-profile')).split(' ');
var cmd = makeCommandStr('container-service', 'delete', paramFileName, util.format('--diagnostics-profile --windows-profile --custom-profile --service-principal-profile')).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('master-profile', 'set', paramFileName, util.format('--dns-prefix %s', containerPrefix + 'master')).split(' ');
Expand All @@ -102,18 +102,22 @@ describe('arm', function() {
var cmd = makeCommandStr('agent-pool-profiles', 'set', paramFileName, util.format('--index 0 --name %s --vm-size Standard_A1 --dns-prefix %s', containerPrefix + 'a1', containerPrefix + 'a2')).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('orchestrator-profile', 'set', paramFileName, util.format('--orchestrator-type %s', 'DCOS', location)).split(' ');
var cmd = makeCommandStr('agent-pool-profiles', 'set', paramFileName, util.format('--index 0 --count 1 --parse')).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('linux-profile', 'set', paramFileName, util.format('--admin-username %s', username)).split(' ');
var cmd = makeCommandStr('orchestrator-profile', 'set', paramFileName, util.format('--orchestrator-type %s', 'DCOS', location)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
suite.execute('acs config %s %s --parameter-file %s --index 0 --key-data %s --json', 'public-keys', 'set', paramFileName, keydata, function(result) {
var cmd = makeCommandStr('linux-profile', 'set', paramFileName, util.format('--admin-username %s', username)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = util.format('acs create -g %s -n %s --parameter-file %s --json', groupName, containerPrefix, paramFileName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
suite.execute('acs config %s %s --parameter-file %s --index 0 --key-data %s --json', 'public-keys', 'set', paramFileName, keydata, function(result) {
result.exitStatus.should.equal(0);
done();
var cmd = util.format('acs create -g %s -n %s --parameter-file %s --json', groupName, containerPrefix, paramFileName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
done();
});
});
});
});
Expand Down Expand Up @@ -151,7 +155,7 @@ describe('arm', function() {
var cmd = makeCommandStr('container-service', 'set', paramFileName2, util.format('--name %s --location %s', containerPrefix2, location)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('container-service', 'delete', paramFileName2, util.format('--diagnostics-profile --windows-profile')).split(' ');
var cmd = makeCommandStr('container-service', 'delete', paramFileName2, util.format('--diagnostics-profile --windows-profile --custom-profile --service-principal-profile')).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('master-profile', 'set', paramFileName2, util.format('--dns-prefix %s', containerPrefix2 + 'master')).split(' ');
Expand All @@ -163,18 +167,22 @@ describe('arm', function() {
var cmd = makeCommandStr('agent-pool-profiles', 'set', paramFileName2, util.format('--index 0 --name %s --vm-size Standard_A1 --dns-prefix %s', containerPrefix2 + 'a1', containerPrefix2 + 'a2')).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('orchestrator-profile', 'set', paramFileName2, util.format('--orchestrator-type %s', 'Swarm', location)).split(' ');
var cmd = makeCommandStr('agent-pool-profiles', 'set', paramFileName2, util.format('--index 0 --count 1 --parse')).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('linux-profile', 'set', paramFileName2, util.format('--admin-username %s', username)).split(' ');
var cmd = makeCommandStr('orchestrator-profile', 'set', paramFileName2, util.format('--orchestrator-type %s', 'Swarm', location)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
suite.execute('acs config %s %s --parameter-file %s --index 0 --key-data %s --json', 'public-keys', 'set', paramFileName2, keydata, function(result) {
var cmd = makeCommandStr('linux-profile', 'set', paramFileName2, util.format('--admin-username %s', username)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = util.format('acs create -g %s -n %s --parameter-file %s --json', groupName, containerPrefix2, paramFileName2).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
suite.execute('acs config %s %s --parameter-file %s --index 0 --key-data %s --json', 'public-keys', 'set', paramFileName2, keydata, function(result) {
result.exitStatus.should.equal(0);
done();
var cmd = util.format('acs create -g %s -n %s --parameter-file %s --json', groupName, containerPrefix2, paramFileName2).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
done();
});
});
});
});
Expand All @@ -190,7 +198,7 @@ describe('arm', function() {

it('container non-empty list should pass', function(done) {
this.timeout(vmTest.timeoutLarge * 10);
var cmd = util.format('acs list -g %s --json', groupName).split(' ');
var cmd = util.format('acs list-by-resource-group -g %s --json', groupName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
result.text.should.containEql(containerPrefix);
Expand Down Expand Up @@ -253,16 +261,26 @@ describe('arm', function() {
});
});

it('container empty list should pass', function(done) {
it('container empty list-by-resource-group should pass', function(done) {
this.timeout(vmTest.timeoutLarge * 10);
var cmd = util.format('acs list -g %s --json', groupName).split(' ');
var cmd = util.format('acs list-by-resource-group -g %s --json', groupName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
result.text.should.containEql('[]');
done();
});
});

it('container empty list should pass', function(done) {
this.timeout(vmTest.timeoutLarge * 10);
var cmd = util.format('acs list --json', groupName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
result.text.should.containEql('[');
result.text.should.containEql(']');
done();
});
});
});
});
});
32 changes: 18 additions & 14 deletions test/commands/arm/vmss/arm.vmss-parameter-create-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ describe('arm', function() {
var cmd = util.format('vmss config create --parameter-file %s', paramFileName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('virtual-machine-scale-set', 'set', paramFileName, util.format('--name %s --location %s --over-provision false', vmssPrefix5, location)).split(' ');
var cmd = makeCommandStr('virtual-machine-scale-set', 'set', paramFileName, util.format('--name %s --location %s --overprovision false', vmssPrefix5, location)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('virtual-machine-scale-set', 'delete', paramFileName, '--type --tags --provisioning-state').split(' ');
var cmd = makeCommandStr('virtual-machine-scale-set', 'delete', paramFileName, '--type --tags --provisioning-state --plan').split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('sku', 'set', paramFileName, '--capacity ' + vmssCapacity + ' --name ' + VMTestUtil.vmSize + ' --tier Standard').split(' ');
Expand Down Expand Up @@ -194,34 +194,38 @@ describe('arm', function() {
var cmd = makeCommandStr('os-profile', 'set', paramFileName, util.format('--computer-name-prefix test --admin-username %s --admin-password %s', username, password)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('image-reference', 'set', paramFileName, '--publisher MicrosoftWindowsServer --offer WindowsServer --sku 2012-R2-Datacenter --version latest').split(' ');
var cmd = makeCommandStr('storage-profile', 'delete', paramFileName, '--data-disks').split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('os-disk', 'set', paramFileName, '--caching None --create-option fromImage --name test').split(' ');
var cmd = makeCommandStr('image-reference', 'set', paramFileName, '--publisher MicrosoftWindowsServer --offer WindowsServer --sku 2012-R2-Datacenter --version latest').split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('os-disk', 'delete', paramFileName, '--os-type --image').split(' ');
var cmd = makeCommandStr('os-disk', 'set', paramFileName, '--caching None --create-option fromImage --name test').split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('vhd-containers', 'delete', paramFileName, '--index 0').split(' ');
var cmd = makeCommandStr('os-disk', 'delete', paramFileName, '--os-type --image --managed-disk').split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('vhd-containers', 'set', paramFileName, util.format('--index 0 --value https://%s.blob.core.windows.net/%s', storageAccount, storageCont)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
var cmd = makeCommandStr('vhd-containers', 'delete', paramFileName, '--index 0').split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('vhd-containers', 'set', paramFileName, util.format('--index 1 --value https://%s.blob.core.windows.net/%s', storageAccount2, storageCont2)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
var cmd = makeCommandStr('vhd-containers', 'set', paramFileName, util.format('--index 0 --value https://%s.blob.core.windows.net/%s', storageAccount, storageCont)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('vhd-containers', 'set', paramFileName, util.format('--index 2 --value https://%s.blob.core.windows.net/%s', storageAccount3, storageCont3)).split(' ');
var cmd = makeCommandStr('vhd-containers', 'set', paramFileName, util.format('--index 1 --value https://%s.blob.core.windows.net/%s', storageAccount2, storageCont2)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = makeCommandStr('extensions', 'set', paramFileName, util.format('--index 0 --name test --publisher %s --type %s --type-handler-version %s --auto-upgrade-minor-version true', publisher, vmaExtName, vmaExtVer)).split(' ');
var cmd = makeCommandStr('vhd-containers', 'set', paramFileName, util.format('--index 2 --value https://%s.blob.core.windows.net/%s', storageAccount3, storageCont3)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
var cmd = util.format('vmss create -g %s -n %s --parameter-file %s --json', groupName, vmssPrefix5, paramFileName).split(' ');
var cmd = makeCommandStr('extensions', 'set', paramFileName, util.format('--index 0 --name test --publisher %s --type %s --type-handler-version %s --auto-upgrade-minor-version true', publisher, vmaExtName, vmaExtVer)).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
done();
var cmd = util.format('vmss create -g %s -n %s --parameter-file %s --json', groupName, vmssPrefix5, paramFileName).split(' ');
testUtils.executeCommand(suite, retry, cmd, function(result) {
result.exitStatus.should.equal(0);
done();
});
});
});
});
Expand Down
10 changes: 5 additions & 5 deletions test/data/containerParam.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
},
"masterProfile": {
"count": 1,
"dnsPrefix": "xplatContainer4527master",
"dnsPrefix": "xplatContainer9457master",
"fqdn": ""
},
"agentPoolProfiles": [
{
"name": "xplatContainer4527a1",
"name": "xplatContainer9457a1",
"count": 2,
"vmSize": "Standard_A1",
"dnsPrefix": "xplatContainer4527a2",
"dnsPrefix": "xplatContainer9457a2",
"fqdn": ""
}
],
Expand All @@ -28,8 +28,8 @@
}
},
"id": null,
"name": "xplatContainer4527",
"name": "xplatContainer9457",
"type": null,
"location": "australiasoutheast",
"location": "eastus",
"tags": {}
}
12 changes: 6 additions & 6 deletions test/data/containerParam2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
},
"masterProfile": {
"count": 1,
"dnsPrefix": "xplatContainer22031master",
"dnsPrefix": "xplatContainer29931master",
"fqdn": ""
},
"agentPoolProfiles": [
{
"name": "xplatContainer22031a1",
"count": null,
"name": "xplatContainer29931a1",
"count": 1,
"vmSize": "Standard_A1",
"dnsPrefix": "xplatContainer22031a2",
"dnsPrefix": "xplatContainer29931a2",
"fqdn": ""
}
],
Expand All @@ -28,8 +28,8 @@
}
},
"id": null,
"name": "xplatContainer22031",
"name": "xplatContainer29931",
"type": null,
"location": "australiasoutheast",
"location": "eastus",
"tags": {}
}
Loading

0 comments on commit 78c72f8

Please sign in to comment.