Permalink
Browse files

Fix issue with hosts.

  • Loading branch information...
Andre Rodrigues
Andre Rodrigues committed Oct 14, 2012
1 parent 19635a2 commit d52f47c97545bd7891f5a877a23802a440ed9eb5
Showing with 26 additions and 5 deletions.
  1. +3 −3 lib/services/core/storageserviceclient.js
  2. +23 −2 test/services/table/tableservice-tests.js
@@ -107,9 +107,9 @@ StorageServiceClient.getStorageSettings = function (storageAccountOrConnectionSt
var parsedHost = ServiceClient._parseHost(host);
- blobendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: storageAccountOrConnectionString + '.' + parsedHost.hostname });
- tableendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: storageAccountOrConnectionString + '.' + parsedHost.hostname });
- queueendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: storageAccountOrConnectionString + '.' + parsedHost.hostname });
+ blobendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: parsedHost.hostname });
+ tableendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: parsedHost.hostname });
+ queueendpoint = url.format({ protocol: parsedHost.protocol, port: parsedHost.port, hostname: parsedHost.hostname });
}
var settings = {
@@ -51,7 +51,7 @@ var tableNames = [];
var tablePrefix = 'tableservice';
var testPrefix = 'tableservice-tests';
-var numberTests = 18;
+var numberTests = 20;
suite('tableservice-tests', function () {
setup(function (done) {
@@ -799,7 +799,7 @@ suite('tableservice-tests', function () {
var expectedKey = process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY];
var connectionString = 'DefaultEndpointsProtocol=' + expectedProtocol + ';AccountName=' + expectedName + ';AccountKey=' + expectedKey;
var tableService = azure.createTableService(connectionString);
- tableService.createTable(tableName, function (err, t, rsp) {
+ tableService.createTable(tableName, function (err) {
assert.equal(err, null);
assert.equal(tableService.storageAccount, expectedName);
@@ -809,4 +809,25 @@ suite('tableservice-tests', function () {
done();
});
});
+
+ test('storageConnectionStringsEndpointHttps', function (done) {
+ var tableName = testutil.generateId(tablePrefix, tableNames, tabletestutil.isMocked);
+ var expectedProtocol = 'https';
+ var expectedName = process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCOUNT];
+ var expectedKey = process.env[ServiceClient.EnvironmentVariables.AZURE_STORAGE_ACCESS_KEY];
+ var expectedTableEndpoint = 'http://andrerod.table.core.windows.net';
+ var connectionString = 'DefaultEndpointsProtocol=' + expectedProtocol + ';AccountName=' + expectedName + ';AccountKey=' + expectedKey + ';TableEndpoint=' + expectedTableEndpoint;
+ var tableService = azure.createTableService(connectionString);
+ tableService.createTable(tableName, function (err) {
+ assert.equal(err, null);
+
+ assert.equal(tableService.storageAccount, expectedName);
+ assert.equal(tableService.storageAccessKey, expectedKey);
+
+ // Explicit table host wins
+ assert.equal(tableService.protocol, 'http://');
+
+ done();
+ });
+ });
});

0 comments on commit d52f47c

Please sign in to comment.