Mercurial > hg > mercurial-source
comparison tests/test-bundle2.t @ 21626:985d139c8e8f
bundle2: ignore advisory part with unknown parameters
Advisory parts are advisory. If a handler exists but does not support the
proper parameters, we can safely ignore it.
Test has been updated to include this case.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 27 May 2014 12:16:45 -0700 |
parents | 511f5fa63aa2 |
children | 7c5a85619dca |
comparison
equal
deleted
inserted
replaced
21625:511f5fa63aa2 | 21626:985d139c8e8f |
---|---|
110 > mathpart = bundler.newpart('test:math') | 110 > mathpart = bundler.newpart('test:math') |
111 > mathpart.addparam('pi', '3.14') | 111 > mathpart.addparam('pi', '3.14') |
112 > mathpart.addparam('e', '2.72') | 112 > mathpart.addparam('e', '2.72') |
113 > mathpart.addparam('cooking', 'raw', mandatory=False) | 113 > mathpart.addparam('cooking', 'raw', mandatory=False) |
114 > mathpart.data = '42' | 114 > mathpart.data = '42' |
115 > # advisory known part with unknown mandatory param | |
116 > bundler.newpart('test:song', [('randomparam','')]) | |
115 > if opts['unknown']: | 117 > if opts['unknown']: |
116 > bundler.newpart('test:UNKNOWN', data='some random content') | 118 > bundler.newpart('test:UNKNOWN', data='some random content') |
117 > if opts['unknownparams']: | 119 > if opts['unknownparams']: |
118 > bundler.newpart('test:SONG', [('randomparams', '')]) | 120 > bundler.newpart('test:SONG', [('randomparams', '')]) |
119 > if opts['parts']: | 121 > if opts['parts']: |
364 bundle part: "test:empty" | 366 bundle part: "test:empty" |
365 bundle part: "test:empty" | 367 bundle part: "test:empty" |
366 bundle part: "test:song" | 368 bundle part: "test:song" |
367 bundle part: "test:debugreply" | 369 bundle part: "test:debugreply" |
368 bundle part: "test:math" | 370 bundle part: "test:math" |
371 bundle part: "test:song" | |
369 bundle part: "test:ping" | 372 bundle part: "test:ping" |
370 end of bundle | 373 end of bundle |
371 | 374 |
372 $ cat ../parts.hg2 | 375 $ cat ../parts.hg2 |
373 HG2X\x00\x00\x00\x11 (esc) | 376 HG2X\x00\x00\x00\x11 (esc) |
374 test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc) | 377 test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc) |
375 test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc) | 378 test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc) |
376 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko | 379 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
377 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00\x16\x0ftest:debugreply\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x04\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) | 380 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.\x00\x00\x00\x00\x00\x16\x0ftest:debugreply\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00+ test:math\x00\x00\x00\x04\x02\x01\x02\x04\x01\x04\x07\x03pi3.14e2.72cookingraw\x00\x00\x00\x0242\x00\x00\x00\x00\x00\x1d test:song\x00\x00\x00\x05\x01\x00\x0b\x00randomparam\x00\x00\x00\x00\x00\x10 test:ping\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
378 | 381 |
379 | 382 |
380 $ hg statbundle2 < ../parts.hg2 | 383 $ hg statbundle2 < ../parts.hg2 |
381 options count: 0 | 384 options count: 0 |
382 :test:empty: | 385 :test:empty: |
397 payload: 0 bytes | 400 payload: 0 bytes |
398 :test:math: | 401 :test:math: |
399 mandatory: 2 | 402 mandatory: 2 |
400 advisory: 1 | 403 advisory: 1 |
401 payload: 2 bytes | 404 payload: 2 bytes |
405 :test:song: | |
406 mandatory: 1 | |
407 advisory: 0 | |
408 payload: 0 bytes | |
402 :test:ping: | 409 :test:ping: |
403 mandatory: 0 | 410 mandatory: 0 |
404 advisory: 0 | 411 advisory: 0 |
405 payload: 0 bytes | 412 payload: 0 bytes |
406 parts count: 6 | 413 parts count: 7 |
407 | 414 |
408 $ hg statbundle2 --debug < ../parts.hg2 | 415 $ hg statbundle2 --debug < ../parts.hg2 |
409 start processing of HG2X stream | 416 start processing of HG2X stream |
410 reading bundle2 stream parameters | 417 reading bundle2 stream parameters |
411 options count: 0 | 418 options count: 0 |
455 mandatory: 2 | 462 mandatory: 2 |
456 advisory: 1 | 463 advisory: 1 |
457 payload chunk size: 2 | 464 payload chunk size: 2 |
458 payload chunk size: 0 | 465 payload chunk size: 0 |
459 payload: 2 bytes | 466 payload: 2 bytes |
467 part header size: 29 | |
468 part type: "test:song" | |
469 part id: "5" | |
470 part parameters: 1 | |
471 :test:song: | |
472 mandatory: 1 | |
473 advisory: 0 | |
474 payload chunk size: 0 | |
475 payload: 0 bytes | |
460 part header size: 16 | 476 part header size: 16 |
461 part type: "test:ping" | 477 part type: "test:ping" |
462 part id: "5" | 478 part id: "6" |
463 part parameters: 0 | 479 part parameters: 0 |
464 :test:ping: | 480 :test:ping: |
465 mandatory: 0 | 481 mandatory: 0 |
466 advisory: 0 | 482 advisory: 0 |
467 payload chunk size: 0 | 483 payload chunk size: 0 |
468 payload: 0 bytes | 484 payload: 0 bytes |
469 part header size: 0 | 485 part header size: 0 |
470 end of bundle2 stream | 486 end of bundle2 stream |
471 parts count: 6 | 487 parts count: 7 |
472 | 488 |
473 Test actual unbundling of test part | 489 Test actual unbundling of test part |
474 ======================================= | 490 ======================================= |
475 | 491 |
476 Process the bundle | 492 Process the bundle |
481 start extraction of bundle2 parts | 497 start extraction of bundle2 parts |
482 part header size: 17 | 498 part header size: 17 |
483 part type: "test:empty" | 499 part type: "test:empty" |
484 part id: "0" | 500 part id: "0" |
485 part parameters: 0 | 501 part parameters: 0 |
486 ignoring unknown advisory part 'test:empty' | 502 ignoring unsupported advisory part test:empty |
487 payload chunk size: 0 | 503 payload chunk size: 0 |
488 part header size: 17 | 504 part header size: 17 |
489 part type: "test:empty" | 505 part type: "test:empty" |
490 part id: "1" | 506 part id: "1" |
491 part parameters: 0 | 507 part parameters: 0 |
492 ignoring unknown advisory part 'test:empty' | 508 ignoring unsupported advisory part test:empty |
493 payload chunk size: 0 | 509 payload chunk size: 0 |
494 part header size: 16 | 510 part header size: 16 |
495 part type: "test:song" | 511 part type: "test:song" |
496 part id: "2" | 512 part id: "2" |
497 part parameters: 0 | 513 part parameters: 0 |
511 payload chunk size: 0 | 527 payload chunk size: 0 |
512 part header size: 43 | 528 part header size: 43 |
513 part type: "test:math" | 529 part type: "test:math" |
514 part id: "4" | 530 part id: "4" |
515 part parameters: 3 | 531 part parameters: 3 |
516 ignoring unknown advisory part 'test:math' | 532 ignoring unsupported advisory part test:math |
517 payload chunk size: 2 | 533 payload chunk size: 2 |
534 payload chunk size: 0 | |
535 part header size: 29 | |
536 part type: "test:song" | |
537 part id: "5" | |
538 part parameters: 1 | |
539 found a handler for part 'test:song' | |
540 ignoring unsupported advisory part test:song - randomparam | |
518 payload chunk size: 0 | 541 payload chunk size: 0 |
519 part header size: 16 | 542 part header size: 16 |
520 part type: "test:ping" | 543 part type: "test:ping" |
521 part id: "5" | 544 part id: "6" |
522 part parameters: 0 | 545 part parameters: 0 |
523 found a handler for part 'test:ping' | 546 found a handler for part 'test:ping' |
524 received ping request (id 5) | 547 received ping request (id 6) |
525 payload chunk size: 0 | 548 payload chunk size: 0 |
526 part header size: 0 | 549 part header size: 0 |
527 end of bundle2 stream | 550 end of bundle2 stream |
528 0 unread bytes | 551 0 unread bytes |
529 3 total verses sung | 552 3 total verses sung |
574 debugreply: 'celeste,ville' | 597 debugreply: 'celeste,ville' |
575 debugreply: 'elephants' | 598 debugreply: 'elephants' |
576 debugreply: 'babar' | 599 debugreply: 'babar' |
577 debugreply: 'celeste' | 600 debugreply: 'celeste' |
578 debugreply: 'ping-pong' | 601 debugreply: 'ping-pong' |
579 \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to6\x00\x00\x00\x00\x00\x1f (esc) | 602 \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to7\x00\x00\x00\x00\x00\x1f (esc) |
580 b2x:output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to6\x00\x00\x00=received ping request (id 6) (esc) | 603 b2x:output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to7\x00\x00\x00=received ping request (id 7) (esc) |
581 replying to ping request (id 6) | 604 replying to ping request (id 7) |
582 \x00\x00\x00\x00\x00\x00 (no-eol) (esc) | 605 \x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
583 | 606 |
584 The reply is valid | 607 The reply is valid |
585 | 608 |
586 $ hg statbundle2 < ../reply.hg2 | 609 $ hg statbundle2 < ../reply.hg2 |
615 remote: debugreply: 'celeste,ville' | 638 remote: debugreply: 'celeste,ville' |
616 remote: debugreply: 'elephants' | 639 remote: debugreply: 'elephants' |
617 remote: debugreply: 'babar' | 640 remote: debugreply: 'babar' |
618 remote: debugreply: 'celeste' | 641 remote: debugreply: 'celeste' |
619 remote: debugreply: 'ping-pong' | 642 remote: debugreply: 'ping-pong' |
620 remote: received ping request (id 6) | 643 remote: received ping request (id 7) |
621 remote: replying to ping request (id 6) | 644 remote: replying to ping request (id 7) |
622 0 unread bytes | 645 0 unread bytes |
623 | 646 |
624 Test push race detection | 647 Test push race detection |
625 | 648 |
626 $ hg bundle2 --pushrace ../part-race.hg2 | 649 $ hg bundle2 --pushrace ../part-race.hg2 |