null+****@clear*****
null+****@clear*****
2012年 8月 9日 (木) 18:00:56 JST
SHIMODA Hiroshi 2012-08-09 18:00:56 +0900 (Thu, 09 Aug 2012) New Revision: 7bb0d60303db976e179a92c89c8cf3a70eb0d336 https://github.com/groonga/gcs/commit/7bb0d60303db976e179a92c89c8cf3a70eb0d336 Log: Update tests for gcs-describe-domain Modified files: bin/gcs-describe-domain test/gcs-commands.test.js Modified: bin/gcs-describe-domain (+1 -0) =================================================================== --- bin/gcs-describe-domain 2012-08-09 17:59:20 +0900 (f1a46f4) +++ bin/gcs-describe-domain 2012-08-09 18:00:56 +0900 (d4e4ee7) @@ -51,6 +51,7 @@ if (commandLine.options.domainName) { } else { var domains = CLI.Domain.getAll(commandLine.context); domains.forEach(function(domain, index) { + if (index) console.log(''); report(domain); }); } Modified: test/gcs-commands.test.js (+64 -21) =================================================================== --- test/gcs-commands.test.js 2012-08-09 17:59:20 +0900 (b9ef3c8) +++ test/gcs-commands.test.js 2012-08-09 18:00:56 +0900 (e24cc5e) @@ -167,19 +167,6 @@ suite('gcs-describe-domain', function() { setup(commonSetup); teardown(commonTeardown); - function report(domain, hostname) { - return [ - 'Domain Name ' + domain.name, - 'Document Service Endpoint ' + domain.getDocumentsEndpoint(hostname), - 'Search Endpoint ' + domain.getSearchEndpoint(hostname), - 'Searchable Documents ' + domain.searchableDocumentsCount, - 'Index Fields ' + domain.name, - 'SearchPartitionCount ' + domain.searchPartitionCount, - 'SearchInstanceCount ' + domain.searchInstanceCount, - 'SearchInstanceType ' + domain.searchInstanceType - ].join('\n'); - } - test('describe one', function(done) { new Domain('domain2', context).createSync(); new Domain('domain1', context).createSync(); @@ -188,9 +175,28 @@ suite('gcs-describe-domain', function() { '--domain-name', 'domain1', '--database-path', temporaryDatabase.path) .next(function(result) { - assert.equal(result.code, 0, result.output.stderr); - assert.include(result.output.stdout, - report(new Domain('domain1', context), 'localhost')); + var domain = new Domain('domain1', context); + assert.deepEqual({ code: result.code, message: result.output.stdout }, + { code: 0, + message: + '=== Domain Summary ===\n' + + 'Domain Name: domain1\n' + + 'Document Service endpoint: ' + + domain.getDocumentsEndpoint('localhost') + '\n' + + 'Search Service endpoint: ' + + domain.getSearchEndpoint('localhost') + '\n' + + 'SearchInstanceType: null\n' + + 'SearchPartitionCount: 0\n' + + 'SearchInstanceCount: 0\n' + + 'Searchable Documents: 0\n' + + 'Current configuration changes require ' + + 'a call to IndexDocuments: No\n' + + '\n' + + '=== Domain Configuration ===\n' + + '\n' + + 'Fields:\n' + + '=======\n' + + '======================\n' }); done(); }) @@ -207,11 +213,48 @@ suite('gcs-describe-domain', function() { '--show-all', '--database-path', temporaryDatabase.path) .next(function(result) { - assert.equal(result.code, 0, result.output.stderr); - assert.include(result.output.stdout, - report(new Domain('domain2', context), 'localhost')); - assert.include(result.output.stdout, - report(new Domain('domain1', context), 'localhost')); + var domain1 = new Domain('domain1', context); + var domain2 = new Domain('domain2', context); + assert.deepEqual({ code: result.code, message: result.output.stdout }, + { code: 0, + message: + '=== Domain Summary ===\n' + + 'Domain Name: domain1\n' + + 'Document Service endpoint: ' + + domain1.getDocumentsEndpoint('localhost') + '\n' + + 'Search Service endpoint: ' + + domain1.getSearchEndpoint('localhost') + '\n' + + 'SearchInstanceType: null\n' + + 'SearchPartitionCount: 0\n' + + 'SearchInstanceCount: 0\n' + + 'Searchable Documents: 0\n' + + 'Current configuration changes require ' + + 'a call to IndexDocuments: No\n' + + '\n' + + '=== Domain Configuration ===\n' + + '\n' + + 'Fields:\n' + + '=======\n' + + '\n' + + '======================\n' + '=== Domain Summary ===\n' + + 'Domain Name: domain2\n' + + 'Document Service endpoint: ' + + domain2.getDocumentsEndpoint('localhost') + '\n' + + 'Search Service endpoint: ' + + domain2.getSearchEndpoint('localhost') + '\n' + + 'SearchInstanceType: null\n' + + 'SearchPartitionCount: 0\n' + + 'SearchInstanceCount: 0\n' + + 'Searchable Documents: 0\n' + + 'Current configuration changes require ' + + 'a call to IndexDocuments: No\n' + + '\n' + + '=== Domain Configuration ===\n' + + '\n' + + 'Fields:\n' + + '=======\n' + + '======================\n' }); done(); }) -------------- next part -------------- HTML$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...Download