temperature-machine icon indicating copy to clipboard operation
temperature-machine copied to clipboard

Some tests are locale dependent

Open Ingramz opened this issue 6 years ago • 7 comments

I'm trying to build the project with sbt assembly and I noticed that a couple of tests fail due to different decimal point character.

[info] ErrorOnTemperatureSpikeTest
[info]
[info] + Delegates
[info] + Errors on spiked value (single sensor)
[info] + Error on spiked values (multiple sensors)
[info] + Recovers from spiked value (single sensor)
[info] + Negative spikes values (single sensor)
[info] + Negative spikes values (single sensor), example from production
[info] + NaN (32.625 - 0.0 / 0.0 * 100 is NaN)
[info] + Infinity (0.0 - 32.625 / 0.0 * 100 is -Infinity)
[error] x Error message on a spiked value (single sensor)
[error]  -\/(SensorSpikeError(List(Spike(A,Temperature(21.6),Temperature(51.1))))) is -\/ but 'An unexpected spike was encountered on:
[error]   sensor(s)             : A
[error]   previous temperatures : 21,6 °C
[error]   spiked temperatures   : 51,1 °C
[error]  ' != 'An unexpected spike was encountered on:
[error]   sensor(s)             : A
[error]   previous temperatures : 21.6 °C
[error]   spiked temperatures   : 51.1 °C
[error]  ' (ErrorOnTemperatureSpikeTest.scala:133)
[error] Actual:   ...d on:
[error] ...  : A
[error] ... : 21[,]6 °C
[error] ... : 51[,]1 °C
[error] Expected: ...d on:
[error] ...  : A
[error] ... : 21[.]6 °C
[error] ... : 51[.]1 °C
[info]
[error] x Error message on a spiked value (multiple sensors)
[error]  -\/(SensorSpikeError(List(Spike(A1,Temperature(21.1),Temperature(51.4)), Spike(A2,Temperature(21.3),Temperature(51.1))))) is -\/ but 'An unexpected spike was encountered on:
[error]   sensor(s)             : A1, A2
[error]   previous temperatures : 21,1 °C, 21,3 °C
[error]   spiked temperatures   : 51,4 °C, 51,1 °C
[error]  ' != 'An unexpected spike was encountered on:
[error]   sensor(s)             : A1, A2
[error]   previous temperatures : 21.1 °C, 21.3 °C
[error]   spiked temperatures   : 51.4 °C, 51.1 °C
[error]  ' (ErrorOnTemperatureSpikeTest.scala:148)
[error] Actual:   ...d on:
[error] ...1, A2
[error] ... : 21[,]1 ...21[,]3 °C
[error] ... : 51[,]4 ...51[,]1 °C
[error] Expected: ...d on:
[error] ...1, A2
[error] ... : 21[.]1 ...21[.]3 °C
[error] ... : 51[.]4 ...51[.]1 °C
[info] ExportEndpointTest
[info]
[error] x convert json to csv
[error]  '"Sensor","Time","Temperature","Difference"
[error]  "bedroom1-sensor-1","11/10/17 08:13","NaN","0"
[error]  "bedroom1-sensor-1","11/10/17 08:14","22.0625","NaN"
[error]  "bedroom1-sensor-1","11/10/17 08:14","22.2625","0,20"' != '"Sensor","Time","Temperature","Difference"
[error]  "bedroom1-sensor-1","11/10/17 08:13","NaN","0"
[error]  "bedroom1-sensor-1","11/10/17 08:14","22.0625","NaN"
[error]  "bedroom1-sensor-1","11/10/17 08:14","22.2625","0.20"' (ExportEndpointTest.scala:55)
[error] Actual:   ...ence"
[error] ...","0"
[error] ..."NaN"
[error] ...5","0[,]20"
[error] Expected: ...ence"
[error] ...","0"
[error] ..."NaN"
[error] ...5","0[.]20"

Forcing locale to English using LC_ALL=C sbt assembly worked. The offending locale should be et_EE.UTF-8.

Ingramz avatar Mar 01 '18 15:03 Ingramz

I've tried setting my location to a few places where I'd expect commas in numerics; brazil, germany but can't reproduce. Where are you, Estonia? Any suggestions how to setup my (dev) machine to replicate?

tobyweston avatar Mar 18 '18 21:03 tobyweston

Yes, I am in Estonia. Make sure that locale -a displays the locales you are trying to use. If you don't have a locale installed, then sudo locale-gen et_EE.UTF-8 should do the trick. Otherwise I think it uses the default fallback locale.

Ingramz avatar Mar 19 '18 06:03 Ingramz

Is this still an issue?

tobyweston avatar Sep 07 '19 11:09 tobyweston

Unsure, I haven't tried in a long time. I'll try a fresh install a bit later.

Ingramz avatar Sep 07 '19 16:09 Ingramz

I can confirm that this is still an issue. Below you will find the output of sbt assembly.

sbt-assembly-log.txt

Ingramz avatar Sep 08 '19 15:09 Ingramz

Ok thanks, any suggestions on how I replicate? What’s your env? OS?

tobyweston avatar Sep 08 '19 16:09 tobyweston

This time I just installed ubuntu 18.04.3 on a VM and selected Estonian as the language, then followed the build from source instructions, installed the required dependencies as needed. But I mean, it should happen with any distro / locale with comma as the decimal separator symbol.

Ingramz avatar Sep 08 '19 17:09 Ingramz