Git Product home page Git Product logo

go-sql-test's Introduction

This project is an integration test, testing various Go database
drivers (for the database/sql package).

To run these tests, in this directory, run:

$ export GOPATH=$PWD

... ignoring your existing GOPATH.  (This project imports all the 3rd
party drivers here, to make things easier to track, and to enable
local fixes while waiting for upstream.)

Then:

$ cd src/sqltest
$ go test -v

or, most of the time, skipping the annoyingly long tests:

$ go test -v -short


****************************************************************************
For MySQL:
****************************************************************************
mysqladmin -uroot -proot create gosqltest

To set set your MySQL user / password run:

$ export GOSQLTEST_MYSQL_USER=user
$ export GOSQLTEST_MYSQL_PASS=password


****************************************************************************
For Postgres: (replacing "bradfitz" with $USER)
****************************************************************************
root@bradfitzlap:/home/bradfitz# su - postgres
postgres@bradfitzlap:~$ psql
postgres=# create database gosqltest;
CREATE DATABASE
postgres=# CREATE USER bradfitz WITH ENCRYPTED PASSWORD 'gosqltest';
CREATE ROLE
postgres=# GRANT ALL PRIVILEGES ON DATABASE gosqltest to bradfitz;
GRANT

****************************************************************************
For Oracle: (replacing "bradfitz" with $USER)
****************************************************************************
root@bradfitzlap:/home/bradfitz# service oracle-xe start
Iff you don't have a nice test database, then i.e.:
sqlplus /nolog <<EOF
CONN sys/sys AS SYSDBA
CREATE DATABASE DB 
  USER SYS IDENTIFIED BY SYS
  USER SYSTEM IDENTIFIED BY SYSTEM
  USER user IDENTIFIED BY password
  LOGFILE GROUP 1 ('/tmp/testdb-redo01.log') SIZE 20M
  MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1
  MAXDATAFILES 100 MAXINSTANCES 1 
  CHARACTER SET AL32UTF8
  NATIONAL CHARACTER SET AL32UTF8
  DATAFILE '/tmp/testdb-data01.dbf'
  EXTENT MANAGEMENT LOCAL
  DEFAULT TEMPORARY TABLESPACE temp 
    DATAFILE '/tmp/testdb-temp01.dbf' SIZE 10M REUSE
  UNDO TABLESPACE undotbs
    DATAFILE '/tmp/testdb-undo01.dbf' SIZE 10M REUSE 
    AUTOEXTEND ON NEXT 512K MAXSIZE 200M;
CREATE TABLESPACE data LOGGING
  DATAFILE '/tmp/testdb-data01.dbf' SIZE 10M REUSE 
  AUTOEXTEND ON NEXT 512K MAXSIZE 100M EXTENT MANAGEMENT LOCAL;
CREATE TABLESPACE indx LOGGING
  DATAFILE '/tmp/testdb-indx01.dbf' SIZE 10M REUSE 
  AUTOEXTEND ON NEXT 512K MAXSIZE 100M EXTENT MANAGEMENT LOCAL;

EXIT
EOF

(More can be read at http://docs.oracle.com/cd/B10501_01/server.920/a96521/create.htm#1003614)


To set set your Oracle user/password@DB run:

$ export GOSQLTEST_ORACLE=user/password@db

this will result connecting to database user/password@sid
The corner case where the sid is a full DSN (with port and everything) is not
fully managed: only port 1521 on localhost is checked for accepting connections.
If you really need the full DSN support, please mail me!

****************************************************************************
For DB2:
****************************************************************************
create database gosqltest

To set set your DB2 user / password run:

$ export GOSQLTEST_DB2_USER=user
$ export GOSQLTEST_DB2_PASS=password

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.