virtualpaper
virtualpaper copied to clipboard
Use ordered map instead of normal maps
In Go a map's order is not explicit and varies a bit. This does not affect Virtualpaper's operation but makes some tests unreliable and they fail 20% of the time. Examples are here:
document_history_test.go:128:
Error Trace: /__w/virtualpaper/virtualpaper/integration_tests/document_history_test.go:128
Error: Not equal:
expected: "{\"key_id\":14,\"value_id\":15}"
actual : "{\"key_id\":14,\"value_id\":14}"
Diff:
--- Expected
+++ Actual
@@ -1 +1 @@
-{"key_id":14,"value_id":15}
+{"key_id":14,"value_id":14}
Test: TestDocumentHistory/TestChangeMetadata
document_history_test.go:132:
Error Trace: /__w/virtualpaper/virtualpaper/integration_tests/document_history_test.go:132
Error: Not equal:
expected: "{\"key_id\":14,\"value_id\":14}"
actual : "{\"key_id\":14,\"value_id\":15}"
Diff:
--- Expected
+++ Actual
@@ -1 +1 @@
-{"key_id":14,"value_id":14}
+{"key_id":14,"value_id":15}
Test: TestDocumentHistory/TestChangeMetadata
=== FAIL: integration_tests TestDocumentHistory (0.25s)
Some library is going to be needed to tackle this.
I would love to work on this issue can you assign me this ?
Absolutely! Please provide a pull request and we can continue there.
This is outdated. Sorting the keys before doing diff solved it.