Homework 2 forum

Possible mistake in test TestGossiper_End_To_End_Download_All

Nutzerbild von Andrej Janchevski
Possible mistake in test TestGossiper_End_To_End_Download_All
von Andrej Janchevski - Montag, 9. November 2020, 21:23


I believe I noticed a mistake at line 2482 in gossiper_test.go, in the unit test "TestGossiper_End_To_End_Download_All".

The indexing here for the content3 array I believe is incorrect and should be content3[i*chunkSize] = byte(i) 

i.e. the same as in the next test TestGossiper_End_To_End_Download_Missing.

This error made the test impossible to pass as the chunks from 1 to 9 had the same data/hash and my IndexShares was overriding my map entries, losing the other ids.

Maybe I'm mistaken and we should store in our indexes how many chunks are duplicates?

Re: Possible mistake in test TestGossiper_End_To_End_Download_All
von Kirill Nikitin - Dienstag, 10. November 2020, 16:11

Hi Andrej,

You are right, it is a mistake. Our intention has been to have the chunks be different, as you suggest. Thanks for spotting it!

I would say that ideally your implementation should be able to handle this situation (e.g., you could have the logic of chunks and of files independent, so if two files share the same chunk, you might have both files point to the same chunk object) but it is not a requirement for the homework—if your implementation passes the tests, you are good to go.

We will push the fix asap!