Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
02edfcdf
Commit
02edfcdf
authored
12 years ago
by
Andy Yates
Browse files
Options
Downloads
Patches
Plain Diff
New test to load the Ensembl schema into a temporary database
parent
41090d4b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/t/schema.t
+43
-0
43 additions, 0 deletions
modules/t/schema.t
with
43 additions
and
0 deletions
modules/t/schema.t
0 → 100644
+
43
−
0
View file @
02edfcdf
use
strict
;
use
warnings
;
use
FindBin
qw/$Bin/
;
use
Test::
More
;
use
Bio::EnsEMBL::Test::
MultiTestDB
;
use
File::Spec::
Functions
qw/updir catfile catdir/
;
my
$db
=
Bio::EnsEMBL::Test::
MultiTestDB
->
new
();
my
$dba
=
$db
->
get_DBAdaptor
('
core
');
my
$dbc
=
$dba
->
dbc
();
# Get file location
my
$sql_dir
=
catdir
(
$Bin
,
updir
(),
updir
(),
'
sql
');
my
$sql_file
=
catfile
(
$sql_dir
,
'
table.sql
');
my
$result
=
ok
(
-
f
$sql_file
,
'
Checking SQL schema file exists
');
if
(
!
$result
)
{
skip
'
Skipping DB creation tests as schema file cannot be found at
'
.
$sql_file
,
1
;
}
else
{
#Create DB & load schema
my
$new_db_name
=
$db
->
create_db_name
('
temp
');
note
'
Creating database
'
.
$new_db_name
;
$dba
->
dbc
()
->
do
("
create database
$new_db_name
");
my
%args
=
(
host
=>
$dbc
->
host
(),
port
=>
$dbc
->
port
(),
user
=>
$dbc
->
username
(),
password
=>
$dbc
->
password
());
my
$cmd_args
=
join
(
q{ }
,
map
{
"
--
${_}
=
$args
{
$_
}
"
}
keys
%args
);
my
$cmd
=
"
mysql
$cmd_args
$new_db_name
<
$sql_file
2>&1
";
my
$output
=
`
$cmd
`;
my
$ec
=
(
$?
>>
8
);
if
(
$ec
!=
0
)
{
note
(
$output
);
fail
("
MySQL command failed with error code '
$ec
'
");
}
else
{
pass
("
MySQL was able to load the Ensembl core schema
");
}
note
'
Dropping database
'
.
$new_db_name
;
$dba
->
dbc
()
->
do
("
drop database
$new_db_name
");
}
done_testing
();
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment