Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#13082 closed (fixed)

Oracle-specific test_long_string backends regression test has a bug

Reported by: stvsmth Owned by: nobody
Component: Database layer (models, ORM) Version: 1.1
Severity: Keywords: regression backends oracle clob nclob
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

In the process of tracking down an Oracle CLOB encoding issue (to be created in another ticket once I get my head around it), I think I've found a bug in the test_long_string regression test. Since this is an Oracle-specific test I am guessing it doesn't get exercised that often.

The test writes a long string to the database then reads it to ensure there are no round-trip encoding issues. The test appears to drop the table before the read happens. You can see this bug by changing the xrange(4000) portion of the test to xrange(40).

======================================================================
ERROR: test_long_string (regressiontests.backends.tests.LongString)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/stvsmth/code/workspaces/django-trunk/tests/regressiontests/backends/tests.py", line 38, in test_long_string
    self.assertEquals(long_str, row[0].read())
DatabaseError: ORA-00942: table or view does not exist

It looks like the read is lazy, so the drop table command needs to happen after the read:

36             row = c.fetchone()
37             c.execute('DROP TABLE ltext')
38             self.assertEquals(long_str, row[0].read())

The attached patch makes this simple change.

----------------------------------------------------------------------
Ran 6 tests in 0.245s

Attachments (1)

test_long_string_fix.diff (594 bytes) - added by stvsmth 4 years ago.

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by stvsmth

comment:1 Changed 4 years ago by russellm

  • Component changed from Testing framework to Database layer (models, ORM)
  • milestone set to 1.2
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

If this is a regression, it needs to be addressed for 1.2

comment:2 Changed 4 years ago by ramiro

  • Summary changed from Backends test_long_string regression test has a bug to Oracle-specific test_long_string backends regression test has a bug

comment:3 Changed 4 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [12913]) Fixed #13082 -- Slight modification to an Oracle test to avoid a problem cause by teardown behavior. Thanks to stvsmth for the report and patch.

comment:4 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.