test-statistics.js 986 B

123456789101112131415161718192021222324252627
  1. var common = require('../../common');
  2. var connection = common.createConnection();
  3. var assert = require('assert');
  4. var statsErr, statsData;
  5. connection.statistics(function(err, data) {
  6. statsErr = err;
  7. statsData = data;
  8. });
  9. connection.end();
  10. process.on('exit', function() {
  11. assert.equal(statsErr, null);
  12. assert.strictEqual(typeof statsData, "object");
  13. assert.strictEqual(statsData.hasOwnProperty("message"), true);
  14. assert.strictEqual(statsData.hasOwnProperty("uptime"), true);
  15. assert.strictEqual(statsData.hasOwnProperty("threads"), true);
  16. assert.strictEqual(statsData.hasOwnProperty("questions"), true);
  17. assert.strictEqual(statsData.hasOwnProperty("slow_queries"), true);
  18. assert.strictEqual(statsData.hasOwnProperty("opens"), true);
  19. assert.strictEqual(statsData.hasOwnProperty("flush_tables"), true);
  20. assert.strictEqual(statsData.hasOwnProperty("open_tables"), true);
  21. assert.strictEqual(statsData.hasOwnProperty("queries_per_second_avg"), true);
  22. });