cowprotocol / dune-sync

Components for syncing off-chain data with Dune Community Sources
4 stars 1 forks source link

Failing unit test #60

Open harisang opened 8 months ago

harisang commented 8 months ago

@fhenneke first pointed out that there is some test that is now failing. Since I am personally a bit ignorant about this, any help would be appreciated. One option would be to just remove this test. cc @bh2smith @MartinquaXD

`=================================== FAILURES =================================== __ TestIPFS.test_get_content ___

self =

def test_get_content(self):
    self.assertEqual(
        {
            "version": "0.1.0",
            "appCode": "CowSwap",
            "metadata": {
                "referrer": {
                    "version": "0.1.0",
                    "address": "0x424a46612794dbb8000194937834250Dc723fFa5",
                }
            },
        },
        Cid.old_schema(
            "3d876de8fcd70969349c92d731eeb0482fe8667ceca075592b8785081d630b9a"
        ).get_content(ACCESS_KEY, max_retries=10),
    )
       self.assertEqual(
        {
            "version": "1.0.0",
            "appCode": "CowSwap",
            "metadata": {
                "referrer": {
                    "kind": "referrer",
                    "referrer": "0x8c35B7eE520277D14af5F6098835A584C337311b",
                    "version": "1.0.0",
                }
            },
        },
        Cid.old_schema(
            "1FE7C5555B3F9C14FF7C60D90F15F1A5B11A0DA5B1E8AA043582A1B2E1058D0C"
        ).get_content(ACCESS_KEY),
    )
 AssertionError: {'version': '1.0.0', 'appCode': 'CowSwap'[122 chars]0'}}} != None

tests/unit/test_ipfs.py:73: AssertionError
=========================== short test summary info ============================
FAILED tests/unit/test_ipfs.py::TestIPFS::test_get_content - AssertionError: {'version': '1.0.0', 'appCode': 'CowSwap'[122 chars]0'}}} != None`
bh2smith commented 8 months ago

At first looks like an "intermittent failure" possibly because of a failure to retrieve app_data at the given hash. Have you tried running the test locally? Because one would not expect to get None.

harisang commented 8 months ago

Will try to do that.

Btw, there is some "inconsistency" in the code, but i have no idea if this affects things. In that test, in some cases we use

.get_content(ACCESS_KEY, max_retries=10)

and in some other cases we have .get_content(ACCESS_KEY)

Not sure if this max_retries would change anything though

bh2smith commented 8 months ago

max_retries is an optional field which defaults to ... something. Should be able to see this in the function signature.

harisang commented 8 months ago

max_retries is an optional field which defaults to ... something. Should be able to see this in the function signature.

Right, indeed this defaults to 3, so probably it shouldn't affect things.

I ran the tests locally and i am observing the same error as the one reported above.

bh2smith commented 8 months ago

Is it possible that someone has purged the old data? I always thought IPFS was immutable/permanent storage.

MartinquaXD commented 8 months ago

AFAIK the only guaranteed way for data to stay available on IPFS is if you run your own node and pin the data you are interested in yourself. Otherwise people purge the data.

One option would be to just remove this test.

We could do that but I guess it would be nicer to find some other data that is still available on IPFS and replace the test. (Although that only delays the problem until we run our own IPFS node just for this purpose 😅)

harisang commented 8 months ago

but I guess it would be nicer to find some other data that is still available on IPFS and replace the test.

True, but that requires first understanding what the test is actually testing.... Might give it a shot at some point.

MartinquaXD commented 8 months ago

These tests basically just assert that the python library is able to find a document stored on IPFS given the IPFS hash and that the found document matches your expected object.