Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: utils/tests/pub/pub_test.dart

Issue 10874039: Use ephemeral ports for serving stuff during the pub tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | utils/tests/pub/test_pub.dart » ('j') | utils/tests/pub/test_pub.dart » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #library('pub_tests'); 5 #library('pub_tests');
6 6
7 #import('dart:io'); 7 #import('dart:io');
8 8
9 #import('test_pub.dart'); 9 #import('test_pub.dart');
10 #import('../../../pkg/unittest/unittest.dart'); 10 #import('../../../pkg/unittest/unittest.dart');
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 dir(packagesPath, [ 290 dir(packagesPath, [
291 dir('foo', [ 291 dir('foo', [
292 file('foo.dart', 'main() => "foo 1";') 292 file('foo.dart', 'main() => "foo 1";')
293 ]) 293 ])
294 ]).scheduleValidate(); 294 ]).scheduleValidate();
295 295
296 run(); 296 run();
297 }); 297 });
298 298
299 test('checks out a package from a pub server', () { 299 test('checks out a package from a pub server', () {
300 servePackages("localhost", 3123, [package("foo", "1.2.3")]); 300 servePackages([package("foo", "1.2.3")]);
301 301
302 appDir([dependency("foo", "1.2.3")]).scheduleCreate(); 302 appDir([dependency("foo", "1.2.3")]).scheduleCreate();
303 303
304 schedulePub(args: ['install'], 304 schedulePub(args: ['install'],
305 output: const RegExp("Dependencies installed!\$")); 305 output: const RegExp("Dependencies installed!\$"));
306 306
307 cacheDir({"foo": "1.2.3"}).scheduleValidate(); 307 cacheDir({"foo": "1.2.3"}).scheduleValidate();
308 packagesDir({"foo": "1.2.3"}).scheduleValidate(); 308 packagesDir({"foo": "1.2.3"}).scheduleValidate();
309 309
310 run(); 310 run();
311 }); 311 });
312 312
313 test('checks out packages transitively from a pub server', () { 313 test('checks out packages transitively from a pub server', () {
314 servePackages("localhost", 3123, [ 314 servePackages([
315 package("foo", "1.2.3", [dependency("bar", "2.0.4")]), 315 package("foo", "1.2.3", [dependency("bar", "2.0.4")]),
316 package("bar", "2.0.3"), 316 package("bar", "2.0.3"),
317 package("bar", "2.0.4"), 317 package("bar", "2.0.4"),
318 package("bar", "2.0.5") 318 package("bar", "2.0.5")
319 ]); 319 ]);
320 320
321 appDir([dependency("foo", "1.2.3")]).scheduleCreate(); 321 appDir([dependency("foo", "1.2.3")]).scheduleCreate();
322 322
323 schedulePub(args: ['install'], 323 schedulePub(args: ['install'],
324 output: const RegExp("Dependencies installed!\$")); 324 output: const RegExp("Dependencies installed!\$"));
325 325
326 cacheDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate(); 326 cacheDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate();
327 packagesDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate(); 327 packagesDir({"foo": "1.2.3", "bar": "2.0.4"}).scheduleValidate();
328 328
329 run(); 329 run();
330 }); 330 });
331 331
332 test('resolves version constraints from a pub server', () { 332 test('resolves version constraints from a pub server', () {
333 servePackages("localhost", 3123, [ 333 servePackages([
334 package("foo", "1.2.3", [dependency("baz", ">=2.0.0")]), 334 package("foo", "1.2.3", [dependency("baz", ">=2.0.0")]),
335 package("bar", "2.3.4", [dependency("baz", "<3.0.0")]), 335 package("bar", "2.3.4", [dependency("baz", "<3.0.0")]),
336 package("baz", "2.0.3"), 336 package("baz", "2.0.3"),
337 package("baz", "2.0.4"), 337 package("baz", "2.0.4"),
338 package("baz", "3.0.1") 338 package("baz", "3.0.1")
339 ]); 339 ]);
340 340
341 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); 341 appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
342 342
343 schedulePub(args: ['install'], 343 schedulePub(args: ['install'],
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 dir(packagesPath, [ 467 dir(packagesPath, [
468 dir('foo', [ 468 dir('foo', [
469 file('foo.dart', 'main() => "foo 1.0.0";') 469 file('foo.dart', 'main() => "foo 1.0.0";')
470 ]) 470 ])
471 ]).scheduleValidate(); 471 ]).scheduleValidate();
472 472
473 run(); 473 run();
474 }); 474 });
475 475
476 test('keeps a pub server package locked to the version in the lockfile', () { 476 test('keeps a pub server package locked to the version in the lockfile', () {
477 servePackages("localhost", 3123, [package("foo", "1.0.0")]); 477 servePackages([package("foo", "1.0.0")]);
478 478
479 appDir([dependency("foo")]).scheduleCreate(); 479 appDir([dependency("foo")]).scheduleCreate();
480 480
481 // This install should lock the foo dependency to version 1.0.0. 481 // This install should lock the foo dependency to version 1.0.0.
482 schedulePub(args: ['install'], 482 schedulePub(args: ['install'],
483 output: const RegExp(@"Dependencies installed!$")); 483 output: const RegExp(@"Dependencies installed!$"));
484 484
485 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 485 packagesDir({"foo": "1.0.0"}).scheduleValidate();
486 486
487 // Delete the packages path to simulate a new checkout of the application. 487 // Delete the packages path to simulate a new checkout of the application.
488 dir(packagesPath).scheduleDelete(); 488 dir(packagesPath).scheduleDelete();
489 489
490 // Start serving a newer package as well. 490 // Start serving a newer package as well.
491 servePackages("localhost", 3123, [ 491 servePackages([package("foo", "1.0.1")]);
492 package("foo", "1.0.0"),
493 package("foo", "1.0.1")
494 ]);
495 492
496 // This install shouldn't update the foo dependency due to the lockfile. 493 // This install shouldn't update the foo dependency due to the lockfile.
497 schedulePub(args: ['install'], 494 schedulePub(args: ['install'],
498 output: const RegExp(@"Dependencies installed!$")); 495 output: const RegExp(@"Dependencies installed!$"));
499 496
500 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 497 packagesDir({"foo": "1.0.0"}).scheduleValidate();
501 498
502 run(); 499 run();
503 }); 500 });
504 501
505 test('updates a locked pub server package with a new incompatible ' 502 test('updates a locked pub server package with a new incompatible '
506 'constraint', () { 503 'constraint', () {
507 servePackages("localhost", 3123, [package("foo", "1.0.0")]); 504 servePackages([package("foo", "1.0.0")]);
508 505
509 appDir([dependency("foo")]).scheduleCreate(); 506 appDir([dependency("foo")]).scheduleCreate();
510 507
511 schedulePub(args: ['install'], 508 schedulePub(args: ['install'],
512 output: const RegExp(@"Dependencies installed!$")); 509 output: const RegExp(@"Dependencies installed!$"));
513 510
514 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 511 packagesDir({"foo": "1.0.0"}).scheduleValidate();
515 512
516 servePackages("localhost", 3123, [ 513 servePackages([package("foo", "1.0.1")]);
517 package("foo", "1.0.0"),
518 package("foo", "1.0.1")
519 ]);
520 514
521 appDir([dependency("foo", ">1.0.0")]).scheduleCreate(); 515 appDir([dependency("foo", ">1.0.0")]).scheduleCreate();
522 516
523 schedulePub(args: ['install'], 517 schedulePub(args: ['install'],
524 output: const RegExp(@"Dependencies installed!$")); 518 output: const RegExp(@"Dependencies installed!$"));
525 519
526 packagesDir({"foo": "1.0.1"}).scheduleValidate(); 520 packagesDir({"foo": "1.0.1"}).scheduleValidate();
527 521
528 run(); 522 run();
529 }); 523 });
530 524
531 test("doesn't update a locked pub server package with a new compatible " 525 test("doesn't update a locked pub server package with a new compatible "
532 "constraint", () { 526 "constraint", () {
533 servePackages("localhost", 3123, [package("foo", "1.0.0")]); 527 servePackages([package("foo", "1.0.0")]);
534 528
535 appDir([dependency("foo")]).scheduleCreate(); 529 appDir([dependency("foo")]).scheduleCreate();
536 530
537 schedulePub(args: ['install'], 531 schedulePub(args: ['install'],
538 output: const RegExp(@"Dependencies installed!$")); 532 output: const RegExp(@"Dependencies installed!$"));
539 533
540 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 534 packagesDir({"foo": "1.0.0"}).scheduleValidate();
541 535
542 servePackages("localhost", 3123, [ 536 servePackages([package("foo", "1.0.1")]);
543 package("foo", "1.0.0"),
544 package("foo", "1.0.1")
545 ]);
546 537
547 appDir([dependency("foo", ">=1.0.0")]).scheduleCreate(); 538 appDir([dependency("foo", ">=1.0.0")]).scheduleCreate();
548 539
549 schedulePub(args: ['install'], 540 schedulePub(args: ['install'],
550 output: const RegExp(@"Dependencies installed!$")); 541 output: const RegExp(@"Dependencies installed!$"));
551 542
552 packagesDir({"foo": "1.0.0"}).scheduleValidate(); 543 packagesDir({"foo": "1.0.0"}).scheduleValidate();
553 544
554 run(); 545 run();
555 }); 546 });
556 547
557 test("unlocks dependencies if necessary to ensure that a new dependency " 548 test("unlocks dependencies if necessary to ensure that a new dependency "
558 "is satisfied", () { 549 "is satisfied", () {
559 servePackages("localhost", 3123, [ 550 servePackages([
560 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 551 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
561 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]), 552 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
562 package("baz", "1.0.0", [dependency("qux", "<2.0.0")]), 553 package("baz", "1.0.0", [dependency("qux", "<2.0.0")]),
563 package("qux", "1.0.0") 554 package("qux", "1.0.0")
564 ]); 555 ]);
565 556
566 appDir([dependency("foo")]).scheduleCreate(); 557 appDir([dependency("foo")]).scheduleCreate();
567 558
568 schedulePub(args: ['install'], 559 schedulePub(args: ['install'],
569 output: const RegExp(@"Dependencies installed!$")); 560 output: const RegExp(@"Dependencies installed!$"));
570 561
571 packagesDir({ 562 packagesDir({
572 "foo": "1.0.0", 563 "foo": "1.0.0",
573 "bar": "1.0.0", 564 "bar": "1.0.0",
574 "baz": "1.0.0", 565 "baz": "1.0.0",
575 "qux": "1.0.0" 566 "qux": "1.0.0"
576 }).scheduleValidate(); 567 }).scheduleValidate();
577 568
578 servePackages("localhost", 3123, [ 569 servePackages([
579 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
580 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]), 570 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]),
581
582 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
583 package("bar", "2.0.0", [dependency("baz", "<3.0.0")]), 571 package("bar", "2.0.0", [dependency("baz", "<3.0.0")]),
584
585 package("baz", "1.0.0", [dependency("qux", "<2.0.0")]),
586 package("baz", "2.0.0", [dependency("qux", "<3.0.0")]), 572 package("baz", "2.0.0", [dependency("qux", "<3.0.0")]),
587
588 package("qux", "1.0.0"),
589 package("qux", "2.0.0"), 573 package("qux", "2.0.0"),
590
591 package("newdep", "2.0.0", [dependency("baz", ">=1.5.0")]) 574 package("newdep", "2.0.0", [dependency("baz", ">=1.5.0")])
592 ]); 575 ]);
593 576
594 appDir([dependency("foo"), dependency("newdep")]).scheduleCreate(); 577 appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
595 578
596 schedulePub(args: ['install'], 579 schedulePub(args: ['install'],
597 output: const RegExp(@"Dependencies installed!$")); 580 output: const RegExp(@"Dependencies installed!$"));
598 581
599 packagesDir({ 582 packagesDir({
600 "foo": "2.0.0", 583 "foo": "2.0.0",
601 "bar": "2.0.0", 584 "bar": "2.0.0",
602 "baz": "2.0.0", 585 "baz": "2.0.0",
603 "qux": "1.0.0", 586 "qux": "1.0.0",
604 "newdep": "2.0.0" 587 "newdep": "2.0.0"
605 }).scheduleValidate(); 588 }).scheduleValidate();
606 589
607 run(); 590 run();
608 }); 591 });
609 592
610 test("doesn't unlock dependencies if a new dependency is already " 593 test("doesn't unlock dependencies if a new dependency is already "
611 "satisfied", () { 594 "satisfied", () {
612 servePackages("localhost", 3123, [ 595 servePackages([
613 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 596 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
614 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]), 597 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
615 package("baz", "1.0.0") 598 package("baz", "1.0.0")
616 ]); 599 ]);
617 600
618 appDir([dependency("foo")]).scheduleCreate(); 601 appDir([dependency("foo")]).scheduleCreate();
619 602
620 schedulePub(args: ['install'], 603 schedulePub(args: ['install'],
621 output: const RegExp(@"Dependencies installed!$")); 604 output: const RegExp(@"Dependencies installed!$"));
622 605
623 packagesDir({ 606 packagesDir({
624 "foo": "1.0.0", 607 "foo": "1.0.0",
625 "bar": "1.0.0", 608 "bar": "1.0.0",
626 "baz": "1.0.0" 609 "baz": "1.0.0"
627 }).scheduleValidate(); 610 }).scheduleValidate();
628 611
629 servePackages("localhost", 3123, [ 612 servePackages([
630 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
631 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]), 613 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]),
632
633 package("bar", "1.0.0", [dependency("baz", "<2.0.0")]),
634 package("bar", "2.0.0", [dependency("baz", "<3.0.0")]), 614 package("bar", "2.0.0", [dependency("baz", "<3.0.0")]),
635
636 package("baz", "1.0.0"),
637 package("baz", "2.0.0"), 615 package("baz", "2.0.0"),
638
639 package("newdep", "2.0.0", [dependency("baz", ">=1.0.0")]) 616 package("newdep", "2.0.0", [dependency("baz", ">=1.0.0")])
640 ]); 617 ]);
641 618
642 appDir([dependency("foo"), dependency("newdep")]).scheduleCreate(); 619 appDir([dependency("foo"), dependency("newdep")]).scheduleCreate();
643 620
644 schedulePub(args: ['install'], 621 schedulePub(args: ['install'],
645 output: const RegExp(@"Dependencies installed!$")); 622 output: const RegExp(@"Dependencies installed!$"));
646 623
647 packagesDir({ 624 packagesDir({
648 "foo": "1.0.0", 625 "foo": "1.0.0",
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 dir('foo-dep', [ 778 dir('foo-dep', [
802 file('foo-dep.dart', 'main() => "foo-dep";') 779 file('foo-dep.dart', 'main() => "foo-dep";')
803 ]), 780 ]),
804 ]).scheduleValidate(); 781 ]).scheduleValidate();
805 782
806 run(); 783 run();
807 }); 784 });
808 785
809 test("updates one locked pub server package's dependencies if it's " 786 test("updates one locked pub server package's dependencies if it's "
810 "necessary", () { 787 "necessary", () {
811 servePackages("localhost", 3123, [ 788 servePackages([
812 package("foo", "1.0.0", [dependency("foo-dep")]), 789 package("foo", "1.0.0", [dependency("foo-dep")]),
813 package("foo-dep", "1.0.0") 790 package("foo-dep", "1.0.0")
814 ]); 791 ]);
815 792
816 appDir([dependency("foo")]).scheduleCreate(); 793 appDir([dependency("foo")]).scheduleCreate();
817 794
818 schedulePub(args: ['install'], 795 schedulePub(args: ['install'],
819 output: const RegExp(@"Dependencies installed!$")); 796 output: const RegExp(@"Dependencies installed!$"));
820 797
821 packagesDir({ 798 packagesDir({
822 "foo": "1.0.0", 799 "foo": "1.0.0",
823 "foo-dep": "1.0.0" 800 "foo-dep": "1.0.0"
824 }).scheduleValidate(); 801 }).scheduleValidate();
825 802
826 servePackages("localhost", 3123, [ 803 servePackages([
827 package("foo", "2.0.0", [dependency("foo-dep", ">1.0.0")]), 804 package("foo", "2.0.0", [dependency("foo-dep", ">1.0.0")]),
828 package("foo-dep", "2.0.0") 805 package("foo-dep", "2.0.0")
829 ]); 806 ]);
830 807
831 schedulePub(args: ['update', 'foo'], 808 schedulePub(args: ['update', 'foo'],
832 output: const RegExp(@"Dependencies updated!$")); 809 output: const RegExp(@"Dependencies updated!$"));
833 810
834 packagesDir({ 811 packagesDir({
835 "foo": "2.0.0", 812 "foo": "2.0.0",
836 "foo-dep": "2.0.0" 813 "foo-dep": "2.0.0"
837 }).scheduleValidate(); 814 }).scheduleValidate();
838 815
839 run(); 816 run();
840 }); 817 });
841 818
842 test("updates a locked package's dependers in order to get it to max " 819 test("updates a locked package's dependers in order to get it to max "
843 "version", () { 820 "version", () {
844 servePackages("localhost", 3123, [ 821 servePackages([
845 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]), 822 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
846 package("bar", "1.0.0") 823 package("bar", "1.0.0")
847 ]); 824 ]);
848 825
849 appDir([dependency("foo"), dependency("bar")]).scheduleCreate(); 826 appDir([dependency("foo"), dependency("bar")]).scheduleCreate();
850 827
851 schedulePub(args: ['install'], 828 schedulePub(args: ['install'],
852 output: const RegExp(@"Dependencies installed!$")); 829 output: const RegExp(@"Dependencies installed!$"));
853 830
854 packagesDir({ 831 packagesDir({
855 "foo": "1.0.0", 832 "foo": "1.0.0",
856 "bar": "1.0.0" 833 "bar": "1.0.0"
857 }).scheduleValidate(); 834 }).scheduleValidate();
858 835
859 servePackages("localhost", 3123, [ 836 servePackages([
860 package("foo", "1.0.0", [dependency("bar", "<2.0.0")]),
861 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]), 837 package("foo", "2.0.0", [dependency("bar", "<3.0.0")]),
862
863 package("bar", "1.0.0"),
864 package("bar", "2.0.0") 838 package("bar", "2.0.0")
865 ]); 839 ]);
866 840
867 schedulePub(args: ['update', 'bar'], 841 schedulePub(args: ['update', 'bar'],
868 output: const RegExp(@"Dependencies updated!$")); 842 output: const RegExp(@"Dependencies updated!$"));
869 843
870 packagesDir({ 844 packagesDir({
871 "foo": "2.0.0", 845 "foo": "2.0.0",
872 "bar": "2.0.0" 846 "bar": "2.0.0"
873 }).scheduleValidate(); 847 }).scheduleValidate();
874 848
875 run(); 849 run();
876 }); 850 });
877 }); 851 });
878 } 852 }
879 853
880 versionCommand() { 854 versionCommand() {
881 test('displays the current version', () => 855 test('displays the current version', () =>
882 runPub(args: ['version'], output: VERSION_STRING)); 856 runPub(args: ['version'], output: VERSION_STRING));
883 } 857 }
OLDNEW
« no previous file with comments | « no previous file | utils/tests/pub/test_pub.dart » ('j') | utils/tests/pub/test_pub.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698