Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tickets/dm 2701 #1

Merged
merged 2 commits into from
May 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions tests/DbStorage_1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <sys/time.h>
#include "lsst/daf/persistence/DbStorage.h"
#include "lsst/daf/persistence/LogicalLocation.h"
#include "lsst/daf/persistence/DbAuth.h"
#include "lsst/pex/exceptions.h"

#define BOOST_TEST_MODULE DbStorage_1
Expand All @@ -44,6 +45,14 @@ BOOST_AUTO_TEST_SUITE(DbStorageSuite)
BOOST_AUTO_TEST_CASE(DbStorage) {
lsst::pex::policy::Policy::Ptr policy(new lsst::pex::policy::Policy);

//If the user cannot access the test database, exit
//without failing
dafPersist::DbAuth testAuth;
testAuth.setPolicy(policy);
if(!testAuth.available("lsst10.ncsa.uiuc.edu","3306")){
return;
}

struct timeval tv;
gettimeofday(&tv, 0);
long long testId = tv.tv_sec * 1000000LL + tv.tv_usec;
Expand Down Expand Up @@ -136,6 +145,14 @@ BOOST_AUTO_TEST_CASE(DbStorage) {
BOOST_AUTO_TEST_CASE(DbStorageExprs) {
lsst::pex::policy::Policy::Ptr policy(new lsst::pex::policy::Policy);

//If the user cannot access the test database, exit
//without failing
dafPersist::DbAuth testAuth;
testAuth.setPolicy(policy);
if(!testAuth.available("lsst10.ncsa.uiuc.edu","3306")){
return;
}

// Normally, we would create a DbStorage via
// Persistence::getRetrieveStorage(). For testing purposes, we create one
// ourselves.
Expand Down
9 changes: 9 additions & 0 deletions tests/Persistence_1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ extern "C" {
#include "lsst/daf/persistence/DbTsvStorage.h"
#include "lsst/daf/persistence/Formatter.h"
#include "lsst/daf/persistence/LogicalLocation.h"
#include "lsst/daf/persistence/DbAuth.h"
#include "lsst/daf/persistence/Persistence.h"

#define BOOST_TEST_MODULE Persistence_1
Expand Down Expand Up @@ -185,6 +186,14 @@ BOOST_AUTO_TEST_CASE(PersistenceTest) {
// Define a blank Policy.
lsst::pex::policy::Policy::Ptr policy(new lsst::pex::policy::Policy);

//If the user cannot access the test database, exit
//without failing
dafPersist::DbAuth testAuth;
testAuth.setPolicy(policy);
if(!testAuth.available("lsst10.ncsa.uiuc.edu","3306")){
return;
}

// Get a unique id for this test.
struct timeval tv;
gettimeofday(&tv, 0);
Expand Down
9 changes: 9 additions & 0 deletions tests/Persistence_2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "lsst/daf/persistence/DbStorage.h"
#include "lsst/daf/persistence/Formatter.h"
#include "lsst/daf/persistence/LogicalLocation.h"
#include "lsst/daf/persistence/DbAuth.h"
#include "lsst/daf/persistence/Persistence.h"

#define BOOST_TEST_MODULE Persistence_2
Expand Down Expand Up @@ -192,6 +193,14 @@ BOOST_AUTO_TEST_CASE(Persistence2Test) {
// Define a blank Policy.
lsst::pex::policy::Policy::Ptr policy(new lsst::pex::policy::Policy);

//If the user cannot access the test database, exit
//without failing
dafPersist::DbAuth testAuth;
testAuth.setPolicy(policy);
if(!testAuth.available("lsst10.ncsa.uiuc.edu","3306")){
return;
}

// Get a unique id for this test.
struct timeval tv;
gettimeofday(&tv, 0);
Expand Down
5 changes: 5 additions & 0 deletions tests/Persistence_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@
# see <http://www.lsstcorp.org/LegalNotices/>.
#

import sys
import lsst.daf.base as dafBase
import lsst.daf.persistence as dafPersist
import lsst.pex.policy as pexPolicy

if not dafPersist.DbAuth.available("lsst10.ncsa.uiuc.edu", "3306"):
print "*** WARNING*** Database authenticator unavailable. Skipping test."
sys.exit()

def test1():
"""
Test PropertySet persistence to database without policy.
Expand Down
5 changes: 0 additions & 5 deletions tests/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,5 @@ from lsst.sconsUtils import scripts
import os

ignoreList = ["cameraMapper.py", "pickleMapper.py"]
if not os.path.exists(os.path.join(os.environ['HOME'], ".lsst/db-auth.paf")):
ignoreList.extend(["DateTime_1", "DbStorage_1", "DbStorage_1.py", "DbStorage_2.py",
"Persistence_1", "Persistence_2", "Persistence_2.py"])
print "WARNING: No fallback database authenticator seen"
print "Database tests are being skipped"

scripts.BasicSConscript.tests(ignoreList=ignoreList)
6 changes: 3 additions & 3 deletions ups/daf_persistence.table
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ setupRequired(mysqlclient)
setupRequired(pex_logging)
setupRequired(pex_policy)

envAppend(LD_LIBRARY_PATH, ${PRODUCT_DIR}/lib)
envAppend(DYLD_LIBRARY_PATH, ${PRODUCT_DIR}/lib)
envPrepend(LD_LIBRARY_PATH, ${PRODUCT_DIR}/lib)
envPrepend(DYLD_LIBRARY_PATH, ${PRODUCT_DIR}/lib)

envAppend(PYTHONPATH, ${PRODUCT_DIR}/python)
envPrepend(PYTHONPATH, ${PRODUCT_DIR}/python)