Skip to content

Problem: tests in test_bigchain_api are not activated#2456

Merged
kansi merged 3 commits intobigchaindb:masterfrom
codegeschrei:activate-api-tests
Aug 22, 2018
Merged

Problem: tests in test_bigchain_api are not activated#2456
kansi merged 3 commits intobigchaindb:masterfrom
codegeschrei:activate-api-tests

Conversation

@codegeschrei
Copy link
Copy Markdown
Contributor

@codegeschrei codegeschrei commented Aug 13, 2018

Solution: remove or active tests

#2381

@kansi kansi mentioned this pull request Aug 13, 2018
16 tasks
@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 14, 2018

Codecov Report

Merging #2456 into master will increase coverage by 0.03%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2456      +/-   ##
==========================================
+ Coverage   89.09%   89.13%   +0.03%     
==========================================
  Files          41       41              
  Lines        2385     2384       -1     
==========================================
  Hits         2125     2125              
+ Misses        260      259       -1

b.write_vote(vote)
b.store_bulk_transactions([signed_create_tx, signed_transfer_tx])

sleep(1)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be no need for this sleep, let's remove it.

class TestBigchainApi(object):

@pytest.mark.tendermint
def test_get_spent_with_double_inclusion_detected(self, b, alice):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please explain why this test was removed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

because we don't have a double inclusion anymore. The test was supposed to test the exception CriticalDoubleInclusion that was removed in #2415. Now with the changes, everything that happens in this test, happens in some other tests too, so we don't need it anymore. If you have an idea how to test a double inclusion I'll gladly rewrite it :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this test should just work as it is i.e. the test tries to insert two transactions with the same transaction ids so it would make sense to keep this test to ensure the transactions are uniquely indexed by their ids.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We still tests the OperationError in another test:

def test_double_inclusion(self, b, alice):

and the existing double spend errors in the test below:
def test_get_spent_with_double_spend_detected(self, b, alice):


@pytest.mark.bdb
@pytest.mark.tendermint
def test_transaction_unicode(b, alice):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I do not see any value in this test. What do you think about removing it?

Copy link
Copy Markdown
Contributor Author

@codegeschrei codegeschrei Aug 14, 2018

Choose a reason for hiding this comment

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

I don't know if it's valuable or not. But I do think it's good to check if unicode works. Maybe someone else has an opinion too

Copy link
Copy Markdown
Contributor

@ldmberman ldmberman Aug 14, 2018

Choose a reason for hiding this comment

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

The test does not even check it. The string we put into the database consists of the ASCII characters and the test does not assert they are interpreted as unicode.

Actually, it does. The string is encoded in UTF-8 before being passed to the database and MongoDB is indeed known to complain about the encoding sometimes. So, let's keep the test.


@pytest.mark.tendermint
def test_get_block_status_for_tx_with_double_inclusion(self, b, alice):
def test_double_inclusion(self, b, alice):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you, please, also update the test below (test_text_search)?

We need to replace

# this query only works with MongoDB
try:
    assets = list(b.text_search('bigchaindb'))
except OperationError as exc:
    assert not isinstance(b.connection, LocalMongoDBConnection)
else:
    assert len(assets) == 3

with

assets = list(b.text_search('bigchaindb'))
assert len(assets) == 3

Using LocalMongoDBConnection is part of the test setup, we should not assert for that.

Solution: remove TransactionNotInValidBlock from tests
@kansi kansi merged commit 55a9151 into bigchaindb:master Aug 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants