sapling/tests/getdb.sh.example
Jun Wu 89744897fb hgsql: make it test-friendly for external users
Summary:
Previously, when running with an external MySQL setup, it's easy to get the
following "mysterious" error when trying to create the "revisions" table:

  ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

This is a cleanup of many minor areas to make it easier for external users
to run the test.

  * Move database schema to `schema.sql`, which could be used as `mysql`
    input directly. Remove schema in other places so `schema.sql` is the
    single source of truth.
  * Change `repo`, `namespace` fields to `varchar` to save space.
  * Explicitly set `latin1(_bin)` in schema to avoid potential encoding
    issues. Also specify `InnoDB` to avoid issues of other engines.
  * Source `getdb.sh` instead of parsing its output. Simplifies `getdb.sh`.
  * Provide an example of `getdb.sh` as `getdb.sh.example`.
  * Add `DROP DATABASE` cleanup. External setup probably don't have `testdb`
    dropped automatically.
  * Change `README.md` with the latest instruction about database and test.
  * Bundle `hg-ssh` so `test-pushpull.t` won't fail if it's missing.

Test Plan: `run-tests.py` and it mostly works on a local, non-prod Linux system.

Reviewers: #sourcecontrol, rmcelroy

Reviewed By: rmcelroy

Subscribers: stash, rmcelroy, tja, durham, andrasbelo

Differential Revision: https://phabricator.intern.facebook.com/D4313981

Signature: t1:4313981:1490381520:7c0c9af72ac3446c5ee31f8c9b4376c4198a6dc8
2017-03-23 19:14:52 -07:00

17 lines
516 B
Plaintext

# This file needs to be named "getdb.sh" to be effective.
# Below is an example. Change the values for your test environment.
DBHOST=localhost
DBPORT=3306
DBUSER=root
DBPASS=
# If DBNAME is empty, it'll be generated randomly and the test user needs to be
# able to create a new database. The generated database will be deleted after
# the test completes.
#
# If DBNAME is not empty, the database will not be deleted automatically. If
# you want to drop it automatically, set DBAUTODROP to 1.
#
# DBNAME=hgsql_test