Skip to content

Commit

Permalink
[wip] ci: add testing for CockroachDB 20.2
Browse files Browse the repository at this point in the history
  • Loading branch information
timgraham committed Aug 31, 2020
1 parent 6548802 commit 81052ae
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
19 changes: 16 additions & 3 deletions django_cockroachdb/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,16 +78,17 @@ def mark_expected_failures(self):
'serializers.test_data.SerializerDataTests.test_python_serializer',
'serializers.test_data.SerializerDataTests.test_xml_serializer',
'serializers.test_data.SerializerDataTests.test_yaml_serializer',
# https://github.com/cockroachdb/cockroach/issues/49329#issuecomment-664677082
'schema.tests.SchemaTests.test_alter',
'schema.tests.SchemaTests.test_alter_numeric_field_keep_null_status',
'schema.tests.SchemaTests.test_alter_smallint_pk_to_smallautofield_pk',
# cockroachdb doesn't distinguish between tables and views. Both
# are included regardless of whether inspectdb's --include-views
# option is set.
'inspectdb.tests.InspectDBTransactionalTests.test_include_views',
'introspection.tests.IntrospectionTests.test_table_names_with_views',
# No sequence for AutoField in cockroachdb.
'introspection.tests.IntrospectionTests.test_sequence_list',
# CharField max_length is ignored on cockroachdb. CharField is
# introspected as TextField.
'introspection.tests.IntrospectionTests.test_get_table_description_col_lengths',
# Unsupported query: unsupported binary operator: <int> / <int>:
# https://github.com/cockroachdb/django-cockroachdb/issues/21
'expressions.tests.ExpressionOperatorTests.test_lefthand_division',
Expand Down Expand Up @@ -156,7 +157,19 @@ def mark_expected_failures(self):
'model_fields.test_jsonfield.TestQuerying.test_deep_distinct',
'model_fields.test_jsonfield.TestQuerying.test_ordering_by_transform',
'model_fields.test_jsonfield.TestQuerying.test_ordering_grouping_by_key_transform',
# unsupported binary operator: <string> -> <string> (desired <jsonb>)
# regression in 20.2 alpha 2.
# https://github.com/cockroachdb/cockroach/issues/52043
'model_fields.test_jsonfield.TestQuerying.test_contains_contained_by_with_key_transform',
'model_fields.test_jsonfield.TestQuerying.test_key_transform_raw_expression',
)
if not self.connection.features.is_cockroachdb_20_2:
expected_failures += (
# CharField max_length is ignored. CharField is introspected as
# TextField.
'introspection.tests.IntrospectionTests.test_get_table_description_col_lengths',
)

for test_name in expected_failures:
test_case_name, _, method_name = test_name.rpartition('.')
test_app = test_name.split('.')[0]
Expand Down
5 changes: 5 additions & 0 deletions django_cockroachdb/features.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.db.backends.postgresql.features import (
DatabaseFeatures as PostgresDatabaseFeatures,
)
from django.utils.functional import cached_property


class DatabaseFeatures(PostgresDatabaseFeatures):
Expand Down Expand Up @@ -53,3 +54,7 @@ class DatabaseFeatures(PostgresDatabaseFeatures):
# This can be removed when CockroachDB adds support for NULL FIRST/LAST:
# https://github.com/cockroachdb/cockroach/issues/6224
supports_order_by_nulls_modifier = False

@cached_property
def is_cockroachdb_20_2(self):
return self.connection.cockroachdb_version >= (20, 2)
2 changes: 1 addition & 1 deletion teamcity-build/build-teamcity-19.2.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
set -x

echo 'CockroachDB 19.2 is not supported with Django 3.1.'
./teamcity-build/build-teamcity.sh "v20.2.0-alpha.2"

0 comments on commit 81052ae

Please sign in to comment.