GithubHelp home page GithubHelp logo

mkindahl / gomysqld Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 0.0 200 KB

Library and utility to easily create and work with servers for testing purposes.

License: GNU General Public License v2.0

Go 98.28% C 1.72%

gomysqld's Introduction

GoMySQL and packages mysqld

Library for working with MySQL server instances from within a Go program. Note that this is not a MySQL client program; it is not used to connect to MySQL servers. You have to use some other library for that.

You can use the go get command to download and install the package from from github.com:

go get github.com/mkindahl/mysqld

Description

The library allow you to create and bootstrap new scatch instances of MySQL servers, run some quick tests or programs, and then remove the servers. It also allow you to manage different versions of servers in the same setup so that you can test, for example, replication between different versions of servers or run test scripts against different versions of servers to check how they behave.

The package contains an API to work with distributions and servers as well as a command-line utility using this API. You will see the command-line interface here; if you're interested in the API, you should look into the package documentation.

Creating a MySQL Stable

To work with a set of servers, you need to create a stable where all the distributions and servers will reside.

gomysql init .

The information will be stored under the .stable directory in the provided directory.

Adding Distributions

Once you have a stable set up, you can add distributions to it. Each distribution is installed from a binary distribution of the MySQL server. If you want to install your own version, you need to build a binary distribution from the source tree and add it to the stable using the command:

gomysql add dist mysql-5.1.71-linux-x86_64-glibc23.tar.gz

If the distribution is an archive, the binary distribution will be copied into the stable directory, but if a directory is given, a soft link will be created in the stable.

Working with Servers

Servers are created from distributions and you can create as many servers as you like. When creating a server, a distribution name can be provided using the -dist flag. However, since distribution names can be quite long, it is sufficient to provide a unambigous substring of the distribution name.

gomysql server add -dist=5.1.71 my_server

If no distribution is provided, a match of all distributions is done, which means that if you have a single distribution, it will pick that one.

gomysql server add my_server

Once you are done with the server, you can remove it using:

gomysql server remove my_server

Developer Notes

If you want to work with the code, there are a few suggestions in this section.

Running tests

Some tests require a distribution to execute. For those tests, a distribution can be provided using the -dist flag. For example, to run the tests using mysql-5.6.14-linux-glibc2.5-i686.tar.gz, provide it with the -dist flag. Some tests require an expected version, so to provide an expected version of the server to be found in the distribution, use the -version flag:

go test -dist=mysql-5.6.14-linux-glibc2.5-i686.tar.gz -version=5.6.14

Tests that require a distribution or an expected version to work will be skipped if no distribution or expected version is provided.

Contributors

This package was written by Mats Kindahl ([email protected]).

License

This software is released under the version 2 of the GNU General Public License.

License information can be found in the LICENSE.txt file.

gomysqld's People

Contributors

mkindahl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.