Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions tests/_utils/local_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@ export DJANGO_HOME=`pwd`

export PYTHONPATH=$DJANGO_HOME:$DJANGO_HOME/tests:$DJANGO_HOME/tests/singlestore_settings:$PYTHONPATH

# uncomment this to run tests without unique constraints on the data base level
# export NOT_ENFORCED_UNIQUE=1

# these are default django apps, we use ROWSTORE REFERENCE tabkes for them
# these are the default django apps, we use ROWSTORE REFERENCE tables for them
export DJANGO_SINGLESTORE_TABLE_STORAGE_TYPE_ADMIN="ROWSTORE REFERENCE"
export DJANGO_SINGLESTORE_TABLE_STORAGE_TYPE_AUTH="ROWSTORE REFERENCE"
export DJANGO_SINGLESTORE_TABLE_STORAGE_TYPE_CONTENTTYPES="ROWSTORE REFERENCE"
export DJANGO_SINGLESTORE_TABLE_STORAGE_TYPE_SITES="ROWSTORE REFERENCE"

# 12 many-to-many fields, just use reference tables to save time
export TABLE_STORAGE_TYPE_PREFETCH_RELATED="ROWSTORE REFERENCE"
export DJANGO_SINGLESTORE_TABLE_STORAGE_TYPE_PREFETCH_RELATED="ROWSTORE REFERENCE"

# abstract models - specifying through is tricky
export TABLE_STORAGE_TYPE_MANY_TO_MANY="ROWSTORE REFERENCE"
export DJANGO_SINGLESTORE_TABLE_STORAGE_TYPE_MANY_TO_MANY="ROWSTORE REFERENCE"

# queries app has a lot of models with OneToOne relationships
export DJANGO_SINGLESTORE_NOT_ENFORCED_UNIQUE_QUERIES=1


# specify the path to the test to run
MODULE_TO_TEST=serializers
MODULE_TO_TEST=""
./tests/runtests.py --settings=singlestore_settings --noinput -v 3 $MODULE_TO_TEST --keepdb
2 changes: 1 addition & 1 deletion tests/_utils/setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ CREATE TABLE `delete_regress_played_with` (
KEY (`toy_id`)
);

CREATE TABLE `delete_regress_researcher_contacts` (
CREATE TABLE `delete_regress_researcher_contact` (
`researcher_id` BIGINT NOT NULL,
`contact_id` BIGINT NOT NULL,
SHARD KEY (`researcher_id`),
Expand Down
4 changes: 2 additions & 2 deletions tests/model_forms/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2944,9 +2944,9 @@ def test_prefetch_related_queryset(self):

class ColorModelChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return ", ".join(c.name for c in obj.colours.all())
return ", ".join(sorted(c.name for c in obj.colours.all()))

field = ColorModelChoiceField(ColourfulItem.objects.prefetch_related("colours"))
field = ColorModelChoiceField(ColourfulItem.objects.prefetch_related("colours").order_by("id"))
with self.assertNumQueries(3): # would be 4 if prefetch is ignored
self.assertEqual(
tuple(field.choices),
Expand Down
2 changes: 2 additions & 0 deletions tests/model_regress/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class NonAutoPK(models.Model):
# Chained foreign keys with to_field produce incorrect query #18432
class Model1(models.Model):
pkey = models.IntegerField(unique=True, db_index=True)

objects = ModelStorageManager(table_storage_type="REFERENCE")


class Model2(models.Model):
Expand Down
Loading