~rogpeppe/juju-core/041-config-agent-version

« back to all changes in this revision

Viewing changes to environs/tools_test.go

  • Committer: Roger Peppe
  • Date: 2012-08-30 12:25:49 UTC
  • mfrom: (443.1.7 juju-core)
  • Revision ID: roger.peppe@canonical.com-20120830122549-jmn0ledsyj1uxhd2
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
419
419
        expect: "public-" + toolsStoragePath("1.0.0"),
420
420
}, {
421
421
        // always use private storage in preference to public storage.
422
 
        version: version.MustParse("1.0.0"),
 
422
        version: version.MustParse("1.9.0"),
423
423
        contents: []string{
424
424
                toolsStoragePath("1.0.2"),
425
425
        },
436
436
        expect: toolsStoragePath("1.0.0"),
437
437
}, {
438
438
        // check that version comparing is numeric, not alphabetical.
439
 
        version: version.MustParse("1.0.0"),
 
439
        version: version.MustParse("1.0.99"),
440
440
        contents: []string{
441
441
                toolsStoragePath("1.0.9"),
442
442
                toolsStoragePath("1.0.10"),
445
445
        expect: toolsStoragePath("1.0.11"),
446
446
}, {
447
447
        // minor version wins over patch version.
448
 
        version: version.MustParse("1.0.0"),
 
448
        version: version.MustParse("1.99.99"),
449
449
        contents: []string{
450
450
                toolsStoragePath("1.9.11"),
451
451
                toolsStoragePath("1.10.10"),
453
453
        },
454
454
        expect: toolsStoragePath("1.11.9"),
455
455
}, {
 
456
        // only earlier versions are chosen.
 
457
        version: version.MustParse("1.10.9"),
 
458
        contents: []string{
 
459
                toolsStoragePath("1.9.10"),
 
460
                toolsStoragePath("1.9.11"),
 
461
                toolsStoragePath("1.10.10"),
 
462
                toolsStoragePath("1.11.9"),
 
463
        },
 
464
        expect: toolsStoragePath("1.9.11"),
 
465
}, {
456
466
        // mismatching series or architecture is ignored.
457
467
        version: version.MustParse("1.0.0"),
458
468
        contents: []string{
637
647
                        newTools("3.2.3-precise-amd64", ""),
638
648
                },
639
649
        },
640
 
        binaryVersion("2.0.0-precise-amd64"),
 
650
        binaryVersion("2.8.8-precise-amd64"),
641
651
        false,
642
652
        newTools("2.2.4-precise-amd64", ""),
643
653
}, {
652
662
                        newTools("3.2.3-precise-amd64", ""),
653
663
                },
654
664
        },
655
 
        binaryVersion("2.0.1-precise-amd64"),
 
665
        binaryVersion("2.8.8-precise-amd64"),
656
666
        false,
657
667
        newTools("2.4.4-precise-amd64", ""),
658
668
}, {
667
677
                        newTools("2.2.3-precise-amd64", ""),
668
678
                },
669
679
        },
670
 
        binaryVersion("2.0.0-precise-amd64"),
 
680
        binaryVersion("2.8.8-precise-amd64"),
671
681
        true,
672
682
        newTools("2.2.3-precise-amd64", ""),
673
683
}, {
681
691
                        newTools("1.2.4-precise-amd64", ""),
682
692
                },
683
693
        },
684
 
        binaryVersion("1.0.0-precise-amd64"),
 
694
        binaryVersion("1.8.8-precise-amd64"),
685
695
        true,
686
696
        newTools("1.2.3-precise-amd64", ""),
687
697
}, {
692
702
                        newTools("1.2.4-precise-amd64", ""),
693
703
                },
694
704
        },
695
 
        binaryVersion("1.0.0-precise-amd64"),
 
705
        binaryVersion("1.8.9-precise-amd64"),
696
706
        true,
697
707
        newTools("1.2.4-precise-amd64", ""),
 
708
}, {
 
709
        // Check that we don't choose a version later
 
710
        // than requested.
 
711
        &environs.ToolsList{
 
712
                Public: []*state.Tools{
 
713
                        newTools("1.2.2-precise-amd64", ""),
 
714
                        newTools("1.2.3-precise-amd64", ""),
 
715
                        newTools("1.3.4-precise-amd64", ""),
 
716
                },
 
717
        },
 
718
        binaryVersion("1.3.3-precise-amd64"),
 
719
        true,
 
720
        newTools("1.2.3-precise-amd64", ""),
698
721
},
699
722
}
700
723