Skip to content

Commit b86388d

Browse files
wcharginbileschi
authored andcommitted
uploader_test: check logical equality of protos (#3519)
Summary: Fixes an oversight in #3507: we can’t assert that the raw bytes are what was expected because the code under test does a proto serialization roundtrip, which is permitted to permute keys. Test Plan: Tests still pass; a test sync shows that internal tests pass now, too. wchargin-branch: uploader-test-proto-equal
1 parent febd564 commit b86388d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tensorboard/uploader/uploader_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ def test_start_uploading_graphs(self):
288288
graph_event = event_pb2.Event(
289289
graph_def=_create_example_graph_bytes(950)
290290
)
291+
expected_graph_def = graph_pb2.GraphDef.FromString(
292+
graph_event.graph_def
293+
)
291294
mock_logdir_loader = mock.create_autospec(logdir_loader.LogdirLoader)
292295
mock_logdir_loader.get_run_events.side_effect = [
293296
{
@@ -311,7 +314,8 @@ def test_start_uploading_graphs(self):
311314
for (i, call) in enumerate(mock_client.WriteBlob.call_args_list):
312315
requests = list(call[0][0])
313316
data = b"".join(r.data for r in requests)
314-
self.assertEqual(data, graph_event.graph_def)
317+
actual_graph_def = graph_pb2.GraphDef.FromString(data)
318+
self.assertProtoEquals(expected_graph_def, actual_graph_def)
315319
self.assertEqual(
316320
set(r.blob_sequence_id for r in requests), {"blob%d" % i},
317321
)

0 commit comments

Comments
 (0)