Hi Jani and all,

On Thursday 27 December 2012 13:28:23 Jani Tiainen wrote:
> 27.12.2012 13:08, Shai Berger kirjoitti:
> > Hi all,
> > 
> > I'm seeing a problem with testing on Oracle, in a setting where there are
> > two defined databases that reference the same connection parameters
> > (this is done to enable operations in two parallel, separate
> > transactions); the 'other' database is not treated as a test database.
> > This means that, during tests, operations on it are performed on the
> > 'production' database (this is all in a development environment,
> > thankfully).
> > 
> > Has anyone else run into this?
> > 
> > Django==1.4.3
> > 
> > Thanks,
> > 
> >     Shai.
> 
> I assume that you're referring to test setup instructions on
> https://code.djangoproject.com/wiki/OracleTestSetup page?
> 

Yes and no: I am referring to a variation on this theme.

> You should see that there is defined TEST_USER, TEST_TBLSPACE and
> TEST_TBLSPACE_TMP variables to different names since those are ones used
> when running tests.
> 

In my case, these values *should* be equal. I am not trying to run the Django 
test suite, but tests for my own applications, and my applications rely on 
having two separate connections to the same database.

> Django uses main user just to [...]

I understand pretty well how the django test framework uses its connections. 
I'm pointing out a case where it isn't doing it correctly.

To clarify: I am defining my databases by something like this in settings:

        DATABASES = {
           'defailt' : ... # some full definition
        }

        DATABASES['auditlog'] = DATABASES['default'].copy()

and I even add this, which should help

        DATABASES['auditlog']['TEST_MIRROR'] = 'default'

but when I run the tests, and print out the configuration from the test runner, 
it looks like this:

{'DATABASES': {'auditlog': {'ENGINE': 'healarium.utils.oracle_backend',
                            'HOST': 'oracle',
                            'NAME': 'orcl',
                            'OPTIONS': {'threaded': True},
                            'PASSWORD': 'xxxx',
                            'PORT': '1521',
                            'TEST_CHARSET': None,
                            'TEST_COLLATION': None,
                            'TEST_MIRROR': 'default',
                            'TEST_NAME': None,
                            'TEST_USER': 'test_usr1',
                            'TIME_ZONE': 'Asia/Jerusalem',
                            'USER': 'usr1'},
               'default': {'ENGINE': 'healarium.utils.oracle_backend',
                           'HOST': 'oracle',
                           'NAME': 'orcl',
                           'OPTIONS': {'threaded': True},
                           'PASSWORD': 'Im_a_lumberjack',
                           'PORT': '1521',
                           'SAVED_PASSWORD': 'xxxx',
                           'SAVED_USER': 'usr1',
                           'TEST_CHARSET': None,
                           'TEST_COLLATION': None,
                           'TEST_MIRROR': None,
                           'TEST_NAME': None,
                           'TEST_USER': 'test_usr1',
                           'TIME_ZONE': 'Asia/Jerusalem',
                           'USER': 'test_usr1'},

The thing to notice is how in 'default' there is a 'SAVED_PASSWORD' and 
'SAVED_USER', and the 'USER' is equal to the 'TEST_USER', while in 'auditlog' 
(the 'other' database connection) these do not hold (the only reason 
'auditlog' has a correct 'TEST_USER' entry is that in trying to track this 
down, I defined it explicitly for 'default' and it was copied).

Hope the issue is now clearer,

        Shai.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to