开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 118

Sliber/GreatSQL

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
master
分支 (7)
标签 (6)
master
greatsql-8.0.32-25
greatsql-8.0.32-24
greatsql-8.0.25-17
greatsql-8.0.25-16
greatsql-8.0.25-15
greatsql-5.7.36-39
GreatSQL-8.0.32-25
GreatSQL-8.0.32-24
GreatSQL-8.0.25-17
GreatSQL-8.0.25-16
GreatSQL-5.7.36-39
GreatSQL-8.0.25-15
master
分支 (7)
标签 (6)
master
greatsql-8.0.32-25
greatsql-8.0.32-24
greatsql-8.0.25-17
greatsql-8.0.25-16
greatsql-8.0.25-15
greatsql-5.7.36-39
GreatSQL-8.0.32-25
GreatSQL-8.0.32-24
GreatSQL-8.0.25-17
GreatSQL-8.0.25-16
GreatSQL-5.7.36-39
GreatSQL-8.0.25-15
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (7)
标签 (6)
master
greatsql-8.0.32-25
greatsql-8.0.32-24
greatsql-8.0.25-17
greatsql-8.0.25-16
greatsql-8.0.25-15
greatsql-5.7.36-39
GreatSQL-8.0.32-25
GreatSQL-8.0.32-24
GreatSQL-8.0.25-17
GreatSQL-8.0.25-16
GreatSQL-5.7.36-39
GreatSQL-8.0.25-15
GreatSQL
/
plugin
/
test_service_sql_api
贡献代码
同步代码
对比差异 通过 Pull Request 同步
同步更新到分支
通过 Pull Request 同步
将会在向当前分支创建一个 Pull
Request,合入后将完成同步
File empty ...
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
/* Copyright (c) 2015, 2022, Oracle and/or its affiliates.
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License, version 2.0,
 as published by the Free Software Foundation.
 This program is also distributed with certain software (including
 but not limited to OpenSSL) that is licensed under separate terms,
 as designated in a particular file or component or in included license
 documentation. The authors of MySQL hereby grant you an additional
 permission to link the program and your derivative works with the
 separately licensed software that they have included with MySQL.
 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. See the
 GNU General Public License, version 2.0, for more details.
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
Testing plugin services
-----------------------
Plugin services are usually APIs provided by the mysqld server. Theses APIs can be tested with 
unit test frameworks like "googletest" by developers. In QA it is preferable to test plugin 
services closer to reality with the help of plugins due to following reasons:
 - Integrating plugin, plugin services, clients and SQL layer for testing interaction between all.
 - Having examples for users close to reality (as described in user manual).
 - Using our (qa) test tools.
Implementing a test plugin
--------------------------
Depending on the specification of a plugin service, the test plugin must have a special plugin type
or even tested with all plugin types.
For the frame work to implement test plugins, the plugin type "daemon" has be chosen. It will be
loaded (started) with the sql statement "INSTALL PLUGIN" and unloaded (stopped) by calling 
"UNINSTALL PLUGIN". There is no other communication between server and daemon unless it will be 
explicitly implemented, e.g. with the help of an API or service. INSTALL and UNINSTALL will be 
executed by a mtr test. The mtr test may of course contain other sql statements to test the 
interaction between plugin (service) and SQL layer.
The plugin shall write its test results into one or more files. These files can then be written
into the result file of the mtr test with the normal mtr commands like "cat_file".
With the help of the log_message service the test plugin can easily write messages into 
"mysqld.1.err". These messages can be made visible in the result file or checked as follows:
Load this log into a table with 2 columns (date, info). The column "date" is ignored as not 
deterministic. The column "info" will be selected by removing "\r" to be compatible to windows
(The err log file on windows contains CR,LF as newline). Select the messages so they will be 
visible in the mtr result file.
A perl snippet can be used for that purpose, too.
In a plugin status and system (sql) variables can be specified. With status variables the 
state of the test execution can be reported to the mtr test calling the test plugin. That might 
be useful to e.g. give a ready message for a test case or the whole plugin. Especially when 
using threads in a test plugin such status variables are useful to synchronize execution of 
plugin and mtr test as both are running in parallel. System variables can be used to e.g. control 
test execution. But, that is very rudimentary as can be used to configure the plugin as its start.
Test plugins
------------
There exist test plugins of type "daemon", which can be taken as examples or frameworks and 
calling mtr tests:
 - "plugin/test_services" for the test plugin written in C++,
 - "mysql-test/suite/test_services" for the corresponding mtr tests.
Test plugins:
 - "test_services.cc" 
 showing how to implement a test plugin for simple plugin services like "LogPluginErr"
 used to write messages to the error log. For each of the services there is a function
 implemented containing the test cases. Instead of using the standard I/O of C++ it is much 
 more comfortable to used "my_open", "my_write", etc. as it covers all platforms.
 "LogPluginErr" writes into "mysqld.1.err". The (selected) contents of these files
 can be seen in the result file of "test_services.test". "test_services.test" didn't create
 a thread. The effect is that the test (mysqld) is waiting until the plugin completes its work.
 A waiting condition to synchronize execution of plugin and mtr test is not necessary.
 - "test_service_threaded.cc" 
 
 runs the same tests as "test_services.cc", but in a thread. This needs synchronization 
 of plugin and mtr test as both are running in parallel. The synchronization will be done 
 by waiting for the plugin (exactly the thread in the plugin) to be finished. If the 
 thread is needing a very long time then the mtr test may run in a timeout.
 - "test_framework.cc"
 is a rudimentary implementation of a daemon plugin, which can be take to create a new one. 
 Of course copying and modifying/extending one of the other plugins to create a new 
 test plugin can be recommended depending on the need of threads.
Using threads has the advantage of limiting test execution with a timeout. That may be interesting 
for long running plugins, testing complex APIs. Plugins needing a short run time may run without threads.
 To create the plugins and run the test do the following:
 - modify "CmakeLists.txt" if you want to add a new test plugin,
 - rebuild ALL or only make test_services by running make in the test_services directory,
 - in mysql-test: "./mtr --suite=test_services test_services" or 
 "./mtr --suite=test_services test_services_threaded"
 If a test case in plugin "test_services" shall be switched off run the test as follows:
 ./mtr --mysqld=--loose-test-services-with-log-message=0 t/test_services.test
That shows a simple way of control test execution with system variables. 
Steps to create a new test plugin
---------------------------------
The following is an example of steps to create a test plugin for a plugin service relying on
the daemon type:
 - Create test_<plugin name>.cc file under mysql/plugin/test_plugins deciding if threading
 is needed or not.
 - Put the test cases for plugin service to be tested in the init function (preferred) and
 the clean up in the deinit function.
 - Add new plugin to plugin.def to make it available to mtr.
 - Create one or more MTR tests.
 - MTR test loads plugin and execute the test cases.
 - After uninstall of the plugin put the test results into the result file of the mtr test.
 - Create a reference result file.
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

GreatSQL is a MySQL branch originated from GreatDB
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/sliber/GreatSQL.git
git@gitee.com:sliber/GreatSQL.git
sliber
GreatSQL
GreatSQL
master
点此查找更多帮助

搜索帮助

评论
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /