Subject: | Testmysqld trait with connect_info, Test::mysql constructor fails silently |
Test::DBIx::Class 0.22
Test::mysqld 0.13
# Test::mysqld starts and runs test mysqld instance without error when
# using the following use statement:
use Test::DBIx::Class {}, 'Batch', 'Author', 'DocType', 'Document';
# The addition of connect_info seems to cause Test::mysqld to fail
# without an exception.
# (see attached file Test-DBIx-Class-bug-report-1.txt).
# connect_info uses the same dsn string reported by Test::DBIx::Class
# during a successful run without connect_info:
use Test::DBIx::Class {
connect_info => [
'DBI:mysql:database=test;host=localhost;mysql_socket=/home/gquotes/DataS
ervice/t/var/tmp/mysql.sock',
'','',
{ mysql_enable_utf8 => 1 },
],
}, 'Batch', 'Author', 'DocType', 'Document';
&Test::DBIx::Class::SchemaManager::Trait::Testmysqld::deploy_testdb
should probably test the value returned by Test::mysqld for definedness
and throw an error with $Test::mysqld::errstr on undefined, unless
there's a way to coerce an automatic exception from &Test::mysqld::new.
A temporary workaround is to set up the test mysqld manually, using the
example listed in the Test::mysqld POD synopsis in a BEGIN sub prior to
the use Test::DBIx::Class statement.
Subject: | Test-DBIx-Class-bug-report-1.txt |
./run_tests -v t/01schema/dbic_05utf8_encoding.t
t/01schema/dbic_05utf8_encoding.t .. mysql_dir=[/home/gquotes/DataService/t/01schema/../var] at t/etc/schema.pl line 6.
# Can't initialize a schema with the given configuration
# Returned Error: DBIx::Class::Storage::DBI::dbh(): DBI Connection failed: DBI connect('database=test;host=localhost;mysql_socket=/home/gquotes/DataService/t/var/tmp/mysql.sock','',...) failed: Can't connect to local MySQL server through socket '/home/gquotes/DataService/t/var/tmp/mysql.sock' (2) at /opt/perl/lib/site_perl/5.12.2/DBIx/Class/Storage/DBI.pm line 1248 at /opt/perl/lib/site_perl/5.12.2/Test/DBIx/Class/SchemaManager.pm line 188
# configuration: {
# 'base_dir' => 't/var',
# 'connect_info' => [
# 'DBI:mysql:database=test;host=localhost;mysql_socket=/home/gquotes/DataService/t/var/tmp/mysql.sock',
# '',
# '',
# {
# 'mysql_enable_utf8' => 1
# }
# ],
# 'fixture_class' => '::PopulateMore',
# 'fixture_sets' => {
# 'default' => [
# 'User',
# {
# 'data' => {
# 'joeadmin' => [
# 1,
# 'joeadmin'
# ]
# },
# 'fields' => [
# 'id',
# 'uid'
# ]
# },
# 'Role',
# {
# 'data' => {
# 'admin' => [
# 1,
# 'admin'
# ]
# },
# 'fields' => [
# 'id',
# 'name'
# ]
# },
# 'UserRole',
# {
# 'data' => {
# 'joeadmin_admin' => [
# 1,
# 1
# ]
# },
# 'fields' => [
# 'user',
# 'role'
# ]
# },
# 'DocType',
# {
# 'data' => {
# 'jokes' => [
# 'jokes'
# ],
# 'poems' => [
# 'poems'
# ],
# 'quotes' => [
# 'quotes'
# ]
# },
# 'fields' => [
# 'name'
# ]
# },
# 'Batch',
# {
# 'data' => {
# 'first' => [
# 1,
# 'Foo Batch 1',
# 'The first batch of Foo documents',
# 1,
# 'DataService::Schema',
# 5
# ],
# 'second' => [
# 12,
# 'Foo Batch 12',
# 'The twelfth batch of Foo documents',
# 1,
# 'DataService::Schema',
# 5
# ]
# },
# 'fields' => [
# 'id',
# 'name',
# 'description',
# 'user',
# 'dbschema',
# 'dbschema_ver'
# ]
# },
# 'Author',
# {
# 'data' => {
# 'first' => [
# 1,
# 42,
# '!Index:Batch.second',
# 'Bob',
# 'Jones',
# 'An author of great reputation.',
# '!Date:January 2, 1900',
# '!Date:April 1, 1945',
# '',
# '',
# 'An author bio.',
# 1
# ]
# },
# 'fields' => [
# 'id',
# 'id_vendor',
# 'batch',
# 'first_name',
# 'last_name',
# 'description',
# 'birth',
# 'death',
# 'suffix',
# 'complete_name',
# 'bio',
# 'image'
# ]
# },
# 'Document',
# {
# 'data' => {
# 'first' => [
# 1,
# '223',
# '!Index:Batch.first',
# 'quotes,tests',
# '!Index:Author.first',
# 42,
# 'This is a test document body.
# It has multiple lines.',
# '',
# '',
# 'http://www.example.com/somesource',
# 'quotes,tags',
# '!Index:DocType.quotes'
# ]
# },
# 'fields' => [
# 'id',
# 'id_vendor',
# 'batch',
# 'category',
# 'author',
# 'author_vendor',
# 'body',
# 'movie',
# 'movie_year',
# 'source',
# 'tags',
# 'type'
# ]
# }
# ]
# },
# 'mysqld' => '/usr/sbin/mysqld',
# 'schema_class' => 'DataService::Schema',
# 'traits' => 'Testmysqld'
# }