scriptPath in test storage

This commit is contained in:
DanB
2013-11-18 20:00:42 +01:00
parent fb9483693f
commit d5c81818ee

View File

@@ -41,8 +41,6 @@ README:
*/
const (
SQL_SCRIPTS_PATH = "/usr/share/cgrates/data/storage"
MYSQL = "mysql"
CREATE_CDRS_TABLES_SQL = "create_cdrs_tables.sql"
CREATE_COSTDETAILS_TABLES_SQL = "create_costdetails_tables.sql"
CREATE_MEDIATOR_TABLES_SQL = "create_mediator_tables.sql"
@@ -51,6 +49,7 @@ const (
var db *MySQLStorage
var testLocal = flag.Bool("local", false, "Perform the tests only on local test environment, not by default.") // This flag will be passed here via "go test -local" args
var scriptsPath = flag.String("scripts_path", "/usr/share/cgrates/data/storage/mysql", "Overwrite default scripts path here")
func TestCreateTables(t *testing.T) {
@@ -65,7 +64,7 @@ func TestCreateTables(t *testing.T) {
db = d.(*MySQLStorage)
}
for _, scriptName := range []string{CREATE_CDRS_TABLES_SQL, CREATE_COSTDETAILS_TABLES_SQL, CREATE_MEDIATOR_TABLES_SQL, CREATE_TARIFFPLAN_TABLES_SQL} {
if err := db.CreateTablesFromScript(path.Join(SQL_SCRIPTS_PATH, MYSQL, scriptName)); err != nil {
if err := db.CreateTablesFromScript(path.Join(*scriptsPath, scriptName)); err != nil {
t.Error("Error on db creation: ", err.Error())
return // No point in going further
}