go.dbus
go.dbus copied to clipboard
Fix flaky tests: don't rely on map iteration order.
Enumerating maps is random in Go. Due to a bug, in Go 1.1 and Go 1.2, enumeration over small maps had a deterministic order. in Go 1.3, the enumeration is always random.
Please merge this patch.
@gpaul @bradfitz I would like to merge this in to github.com/godbus/dbus but I don't see the test which relies on the ordering...
TestFormatVariant.
I found this due to Google's internal testing infrastructure. We're using this patch internally to make tests happy.
Verify with:
$ go get -u github.com/godbus/dbus $ go test -cpu=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 github.com/godbus/dbus --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" --- FAIL: TestFormatVariant (0.00s) variant_test.go:27: test 10: got "{"two": 2, "one": 1}", wanted "{"one": 1, "two": 2}" FAIL FAIL github.com/godbus/dbus 0.201s
@bradfitz ah! thank you. merged into github.com/godbus/dbus