parShowToUse.cpp 2.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include "parTestUtil.h"

using namespace std;

namespace ParserTest {

class ParserShowToUseTest : public ParserTestBase {};

// todo show accounts
// todo show apps
// todo show connections
// todo show create database
// todo show create stable
// todo show create table

TEST_F(ParserShowToUseTest, showDatabases) {
  useDb("root", "test");

  run("show databases");
}

TEST_F(ParserShowToUseTest, showDnodes) {
  useDb("root", "test");

  run("show dnodes");
}

TEST_F(ParserShowToUseTest, showFunctions) {
  useDb("root", "test");

  run("show functions");
}

// todo show licence

TEST_F(ParserShowToUseTest, showIndexes) {
  useDb("root", "test");

  run("show indexes from t1");

  run("show indexes from t1 from test");
}

TEST_F(ParserShowToUseTest, showMnodes) {
  useDb("root", "test");

  run("show mnodes");
}

TEST_F(ParserShowToUseTest, showModules) {
  useDb("root", "test");

  run("show modules");
}

TEST_F(ParserShowToUseTest, showQnodes) {
  useDb("root", "test");

  run("show qnodes");
}

// todo show queries
// todo show scores

TEST_F(ParserShowToUseTest, showStables) {
  useDb("root", "test");

  run("show stables");

  run("show test.stables");

  run("show stables like 'c%'");

  run("show test.stables like 'c%'");
}

TEST_F(ParserShowToUseTest, showStreams) {
  useDb("root", "test");

  run("show streams");
}

TEST_F(ParserShowToUseTest, showTables) {
  useDb("root", "test");

  run("show tables");

  run("show test.tables");

  run("show tables like 'c%'");

  run("show test.tables like 'c%'");
}

// todo show topics

TEST_F(ParserShowToUseTest, showUsers) {
  useDb("root", "test");

  run("show users");
}

// todo show variables

TEST_F(ParserShowToUseTest, showVgroups) {
  useDb("root", "test");

  run("show vgroups");

  run("show test.vgroups");
}

// todo show vnodes

// todo split vgroup

TEST_F(ParserShowToUseTest, useDatabase) {
  useDb("root", "test");

  run("use wxy_db");
}

}  // namespace ParserTest