Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Fixed the bug where design doc was created in CouchDB 3.0 with partition enabled even when the partition flag was false #467

Merged
merged 7 commits into from
May 8, 2020

Conversation

CodipherX
Copy link
Contributor

@CodipherX CodipherX commented May 7, 2020

Checklist

  • Tick to sign-off your agreement to the Developer Certificate of Origin (DCO) 1.1
  • Added tests for code changes or test/build only changes
  • Updated the change log file (CHANGES.md|CHANGELOG.md) or test/build only changes
  • Completed the PR template below:

Description

In CouchDB 3.0.0, when attempting to create a design document with partitioned=false, the cloudant still creates the design doc with partitioned=true
Fixes #466

Approach

In the src/cloudant/design_document.py, in the __init__ function, the partition options were being set only when partition=true.
I added an else clause to set partition option when partition flag is false.

Schema & API Changes

No change

Security and Privacy

No change

Testing

Old commit

Modified existing test design_document_tests.py because it already contains relevant tests for unit testing. Added the new test function test_correct_design_document_partitioned_true and test_correct_design_document_partitioned_false

Latest commit

Modified existing test database_partition_tests.py because it already contains the test for partitioned design doc (test_create_partitioned_design_document). Added the new test function for non-partitioned design doc test_create_non_partitioned_design_document . Reversed the changes in design_document_tests.py made in old commit.
Also updated design_document_tests.py and database_tests.py for checking partition value while validation

Monitoring and Logging

No change

Copy link
Member

@emlaver emlaver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one change before approving

@@ -161,6 +161,32 @@ def test_update_design_document_with_encoded_url(self):
remote_ddoc.fetch()
self.assertEqual(remote_ddoc, ddoc)

def test_correct_design_document_partitioning(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's split this into two test functions: test_design_document_with_partitioned_true and test_design_document_with_partitioned_false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The split is done

Copy link
Member

@emlaver emlaver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, please address the comments in CHANGES.
The build is currently failing. Our team will need to review and fix the errors before merging this PR.

CHANGES.md Outdated
@@ -1,3 +1,7 @@
# 2.14.0 (2020-05-07)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the version to # UNRELEASED. Our team will update this when we release a new version of python-cloudant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done the changes

CHANGES.md Outdated
@@ -1,3 +1,7 @@
# 2.14.0 (2020-05-07)

- [FIXED] Creating design documents with appropriate partition flag
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update this to:
- [FIXED] Set default value for `partitioned` parameter to false when creating a design document.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the update in CHANGES.md

@CodipherX
Copy link
Contributor Author

CodipherX commented May 8, 2020

@emlaver I checked the Travis logs and looks like the tests are failing because of the newly added default "options" for partition=false is not taken into account into those failing tests..
I will fix the conflicting unit tests as well

@emlaver
Copy link
Member

emlaver commented May 8, 2020

@CodipherX Thanks for your hard work! I'll squash and merge this

@emlaver emlaver merged commit 06735af into cloudant:master May 8, 2020
@emlaver emlaver mentioned this pull request May 11, 2020
4 tasks
@ricellis ricellis added this to the 2.14.0 milestone Aug 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Creating a Design Doc with partitioned = false still creates design doc with partitioned enabled
3 participants