Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/evgeni/my_virtualenv
Create throw-away MySQL servers for regression tests
https://github.com/evgeni/my_virtualenv
Last synced: 1 day ago
JSON representation
Create throw-away MySQL servers for regression tests
- Host: GitHub
- URL: https://github.com/evgeni/my_virtualenv
- Owner: evgeni
- License: gpl-2.0
- Created: 2013-12-13T18:54:53.000Z (almost 11 years ago)
- Default Branch: devel
- Last Pushed: 2023-10-04T04:44:59.000Z (almost 1 year ago)
- Last Synced: 2024-04-19T11:07:58.116Z (6 months ago)
- Language: Shell
- Homepage:
- Size: 25.4 KB
- Stars: 6
- Watchers: 5
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
my_virtualenv -- Create throw-away MySQL servers for regression tests
=====================================================================Ever quickly needed a fresh MySQL server to run some tests?
Always envied PostgreSQL for the cool [`pg_virtualenv`][pve]?
Now you can have a piece of the cake too!Installation
------------`git clone https://github.com/evgeni/my_virtualenv.git`
There is no fancy shell script you can `curl ... | sh` (well, actually... nononono, forget it!).
Dependencies
------------* a POSIX compatible shell
* MySQL (tested with 8.0) or MariaDB (tested with 10.6), other versions and flavors should work but are untested
* either [`pwgen`][pwgen] or an MD5 command line tool (either `md5sum` from GNU coreutils or `md5` from OSX or OpenSSL)
* either `ss` (from [iproute2][iproute2]) or `nc` (from any netcat implementation)Configuration
-------------Well, there is none, really.
Usage
-----Either just call `my_virtualenv` and get a fresh shell with a `mysqld` running in the background:
$ my_virtualenv
$ mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.33-1 (Debian)Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Or wrap your tests with it:
$ my_virtualenv make test
echo "CREATE DATABASE test;" | mysql
run-your-cool-mysql-depending-testsAfter the command/shell terminates, the running `mysqld` gets killed and all the data is removed.
Environment
-----------When running `my_virtualenv`, your environment gets poluted with the following (useful) vars:
* `MYSQL_USER` - the user you can connect as
* `MYSQL_PWD` - the password of your user
* `MYSQL_HOME` - the place to find `my.cnf`
* `MYSQL_HOST` - the host `mysqld` is running on (always `localhost`)
* `MYSQL_TCP_PORT` - the TCP port of `mysqld`
* `MYSQL_UNIX_PORT` - the path to the `mysqld` socket[pve]: https://salsa.debian.org/postgresql/postgresql-common/-/blob/master/pg_virtualenv
[pwgen]: http://sourceforge.net/projects/pwgen/
[iproute2]: https://www.kernel.org/pub/linux/utils/net/iproute2/