Merge lp:~dave-cheney/juju-core/172-fix-constraints-test-failure into lp:~go-bot/juju-core/trunk
Proposed by
Dave Cheney
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Dave Cheney | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 2756 | ||||
Proposed branch: | lp:~dave-cheney/juju-core/172-fix-constraints-test-failure | ||||
Merge into: | lp:~go-bot/juju-core/trunk | ||||
Diff against target: |
117 lines (+14/-14) 6 files modified
cmd/juju/bootstrap_test.go (+1/-1) constraints/validation.go (+6/-6) constraints/validation_test.go (+4/-4) state/machine_test.go (+1/-1) state/service_test.go (+1/-1) state/state_test.go (+1/-1) |
||||
To merge this branch: | bzr merge lp:~dave-cheney/juju-core/172-fix-constraints-test-failure | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+220156@code.launchpad.net |
Commit message
constraints: fix lp 1320738
Fixes lp 1320738
Although the red and blue constraints sets are sets, for consistency sort them before looking for the intersection to return predictable error messages. For no particular reason constraints will be sorted by name.
Description of the change
constraints: fix lp 1320738
Fixes lp 1320738
Although the red and blue constraints sets are sets, for consistency sort them before looking for the intersection to return predictable error messages. For no particular reason constraints will be sorted by name.
To post a comment you must log in.
Reviewers: mp+220156_ code.launchpad. net,
Message:
Please take a look.
Description:
constraints: fix lp 1320738
Fixes lp 1320738
Although the red and blue constraints sets are sets, for consistency
sort them before looking for the intersection to return predictable
error messages. For no particular reason constraints will be sorted by
name.
https:/ /code.launchpad .net/~dave- cheney/ juju-core/ 172-fix- constraints- test-failure/ +merge/ 220156
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/91580043/
Affected files (+13, -11 lines): bootstrap_ test.go validation. go validation_ test.go
A [revision details]
M cmd/juju/
M constraints/
M constraints/
Index: [revision details] 20140520044449- ixp17q9u2jbdx2c t
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: constraints/ validation. go validation. go' validation. go 2014-04-30 23:18:40 +0000 validation. go 2014-05-20 05:33:59 +0000
=== modified file 'constraints/
--- constraints/
+++ constraints/
@@ -44,10 +44,10 @@
// NewValidator returns a new constraints Validator instance. string] set.Strings) string] []interface{ }) string] set.Strings) , string] []interface{ }),
func NewValidator() Validator {
- c := validator{}
- c.conflicts = make(map[
- c.vocab = make(map[
- return &c
+ return &validator{
+ conflicts: make(map[
+ vocab: make(map[
+ }
}
type validator struct { Add(attrTag) SortedValues( ) { attrTag] SortedValues( ) { Contains( conflict) { "ambiguous constraints: %q overlaps with %q",
@@ -93,12 +93,12 @@
for attrTag := range attrValues {
attrSet.
}
- for attrTag := range attrValues {
+ for _, attrTag := range attrSet.
conflicts, ok := v.conflicts[
if !ok {
continue
}
- for _, conflict := range conflicts.Values() {
+ for _, conflict := range conflicts.
if attrSet.
return fmt.Errorf(
attrTag, conflict)
}
Index: constraints/ validation_ test.go validation_ test.go' validation_ test.go 2014-05-19 02:53:32 +0000 validation_ test.go 2014-05-20 05:33:59 +0000 "instance- type"}, "cpu-cores" }, "instance- type"}, MustParse( "instance- type=foo mem=4G") MustParse( "cpu-cores= 2")
=== modified file 'constraints/
--- constraints/
+++ constraints/
@@ -39,7 +39,7 @@
reds: []string{"mem", "arch"},
blues: []string{
unsupported: []string{
- err: `ambiguous constraints: "mem" overlaps
with "instance-type"`,
+ err: `ambiguous constraints: "instance-type" overlaps
with "mem"`,
},
{
cons: "root-disk=8G mem=4G arch=amd64 cpu-cores=4 instance-type=foo",
@@ -67,7 +67,7 @@
cons: "root-disk=8G mem=4G cpu-cores=4 instance-type=foo",
reds: []string{"mem", "arch"},
blues: []string{
- err: `ambiguous constraints: "mem" overlaps with "instance-type"`,
+ err: `ambiguous constraints: "instance-type" overlaps with "mem"`,
},
{
cons: "arch=amd64 mem=4G cpu-cores=4",
@@ -336,7 +336,7 @@
consFallback := constraints.
cons := constraints.
_, err := validato...