Navigation Menu

Skip to content

Commit

Permalink
Use hostname defined in test-utils.js
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 15, 2012
1 parent a73c7e6 commit b4ee51b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
54 changes: 27 additions & 27 deletions test/api-configuration.test.js
Expand Up @@ -323,7 +323,7 @@ suite('Configuration API', function() {
test('Get, Action=CreateDomain', function(done) {
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.next(function(response) {
var domain = new Domain('companies', context);
Expand Down Expand Up @@ -363,14 +363,14 @@ suite('Configuration API', function() {
var domain;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.next(function() {
domain = new Domain('companies', context);
assert.isTrue(domain.exists());
})
.get('/?DomainName=companies&Action=DeleteDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.next(function(response) {
assert.isFalse(domain.exists());
Expand Down Expand Up @@ -422,13 +422,13 @@ suite('Configuration API', function() {
var domain;
utils
.get('/?DomainName=domain3&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=domain1&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=domain2&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?Action=DescribeDomains&Version=2011-02-01')
.next(function(response) {
Expand All @@ -451,13 +451,13 @@ suite('Configuration API', function() {
test('Get, Action=DescribeDomains (specified domains)', function(done) {
utils
.get('/?DomainName=domain3&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=domain1&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=domain2&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?Action=DescribeDomains&Version=2011-02-01' +
'&DomainNames.member.1=domain2' +
Expand All @@ -482,7 +482,7 @@ suite('Configuration API', function() {
test('Get, Action=DefineIndexField (text, without options)', function(done) {
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'IndexField.IndexFieldType=text&' +
Expand Down Expand Up @@ -518,7 +518,7 @@ suite('Configuration API', function() {
test('Get, Action=DefineIndexField (text, with options)', function(done) {
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'IndexField.IndexFieldType=text&' +
Expand Down Expand Up @@ -555,7 +555,7 @@ suite('Configuration API', function() {
test('Get, Action=DefineIndexField (uint)', function(done) {
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=age&' +
'IndexField.IndexFieldType=uint&' +
Expand Down Expand Up @@ -589,7 +589,7 @@ suite('Configuration API', function() {
test('Get, Action=DefineIndexField (literal, without options)', function(done) {
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=product&' +
'IndexField.IndexFieldType=literal&' +
Expand Down Expand Up @@ -626,7 +626,7 @@ suite('Configuration API', function() {
test('Get, Action=DefineIndexField (literal, with options)', function(done) {
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=product&' +
'IndexField.IndexFieldType=literal&' +
Expand Down Expand Up @@ -667,7 +667,7 @@ suite('Configuration API', function() {
var domain, field;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'IndexField.IndexFieldType=text&' +
Expand Down Expand Up @@ -700,7 +700,7 @@ suite('Configuration API', function() {
var domain, field;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=age&' +
'IndexField.IndexFieldType=uint&' +
Expand Down Expand Up @@ -733,7 +733,7 @@ suite('Configuration API', function() {
var domain, field;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=product&' +
'IndexField.IndexFieldType=literal&' +
Expand Down Expand Up @@ -779,7 +779,7 @@ suite('Configuration API', function() {
var domain;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'IndexField.IndexFieldType=text&' +
Expand Down Expand Up @@ -816,7 +816,7 @@ suite('Configuration API', function() {
test('Get, Action=DescribeIndexFields (specified fields)', function(done) {
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'IndexField.IndexFieldType=text&' +
Expand Down Expand Up @@ -854,7 +854,7 @@ suite('Configuration API', function() {
test('Get, Action=IndexDocuments', function(done) {
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'Action=DefineIndexField&Version=2011-02-01')
Expand Down Expand Up @@ -907,15 +907,15 @@ suite('Configuration API', function() {
var synonyms = encodeURIComponent(json);
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.next(function() {
domain = new Domain('companies', context);
assert.isFalse(domain.hasSynonymsTableSync());
})
.get('/?Version=2011-02-01&Action=UpdateSynonymOptions&' +
'DomainName=companies&Synonyms='+synonyms, {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.next(function(response) {
assert.isTrue(domain.hasSynonymsTableSync());
Expand Down Expand Up @@ -956,7 +956,7 @@ suite('Configuration API', function() {
var synonyms = encodeURIComponent(json);
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?Version=2011-02-01&Action=DescribeSynonymOptions&' +
'DomainName=companies')
Expand Down Expand Up @@ -1008,7 +1008,7 @@ suite('Configuration API', function() {
var domain;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'Action=DefineIndexField&Version=2011-02-01')
Expand Down Expand Up @@ -1061,7 +1061,7 @@ suite('Configuration API', function() {
var domain;
utils
.get('/?DomainName=companies&Action=CreateDomain&Version=2011-02-01', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.get('/?DomainName=companies&IndexField.IndexFieldName=name&' +
'Action=DefineIndexField&Version=2011-02-01')
Expand Down Expand Up @@ -1104,7 +1104,7 @@ suite('Configuration API', function() {
test('Get, no version', function(done) {
utils
.get('/?Action=unknown', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.next(function(response) {
response = toParsedResponse(response);
Expand All @@ -1129,7 +1129,7 @@ suite('Configuration API', function() {
test('Get, invalid version', function(done) {
utils
.get('/?Version=2011-02-02&Action=unknown', {
'Host': 'cloudsearch.localhost'
'Host': utils.testConfigurationHost
})
.next(function(response) {
response = toParsedResponse(response);
Expand Down
12 changes: 8 additions & 4 deletions test/test-utils.js
Expand Up @@ -11,14 +11,18 @@ var spawn = require('child_process').spawn;

var temporaryDirectory = exports.temporaryDirectory = path.join(__dirname, 'tmp');

var testHost = 'localhost';
var testBaseHost = 'localhost';
var testConfigurationHost = 'configuration.localhost';
var testPort = 3333;
exports.testHost = testHost;
exports.testBaseHost = testBaseHost;
exports.testConfigurationHost = testConfigurationHost;
exports.testPort = testPort;

function setupServer(context) {
var server = gcsServer.createServer({ context: context,
port: testPort });
var server = gcsServer.createServer({ context: context,
port: testPort,
baseHost: exports.testBaseHost,
configurationHost: exports.testConfigurationHost });
server.listen(testPort);
return server;
}
Expand Down

0 comments on commit b4ee51b

Please sign in to comment.