[MAGNOLIA-7296] Solve encoding issue in tests Created: 09/Apr/18  Updated: 24/Apr/18  Resolved: 19/Apr/18

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 5.6.5

Type: Bug Priority: Neutral
Reporter: Michael Mühlebach Assignee: Michael Mühlebach
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Epic Link: Pipelines MVP
Sprint: Basel 141, Basel 143
Story Points: 3

 Description   

Problem

The following two encoding test don't work anymore:

JcrImportCommandTest#yamlImportUtf8IsNotDefaultPlatformEncoding()
InspectorTest#dumpString()

Cause

This issue was caused when moving the main pipeline to AWS and let to igno
The base cause of the issue is that maven uses the platform encoding which is "ANSI_X3.4-1968".

Idea 1: Change platform encoding to UTF-8

Although this would seem the most straight forward solution it turned out to be more complicated. The locale and encoding on AWS instances is already configured to be "en_US.UTF-8" and playing around with those configurations had no effect on the encoding used by maven.

Idea 2: Set encoding on maven explicitly

The MAVEN_OPTS in the global tools configuration of maven does not seem to be used in pipelines. The maven configuration has to be explicitly configured but should work otherwise.

Solution

What actually worked was Idea 1! See comments below to see why it seemed to not work.



 Comments   
Comment by Michael Mühlebach [ 16/Apr/18 ]

Ok I think I found a solution. To set the encoding on maven would have been very cool because of platform independency but did not work for whatever reason. But setting the encoding on the machine directly and restart the slave afterwards did the trick. I did the follow:

{{sudo locale-gen en_US.UTF-8
sudo sh -c 'echo LANG=en_US.UTF-8 >> /etc/environment'
sudo sh -c 'echo LC_ALL=en_US.UTF-8 >> /etc/environment'
sudo update-locale}}

But adding those lines to the init script didn't do anything?! seems to be another issue

Comment by Michael Mühlebach [ 17/Apr/18 ]

Ok the steps would have worked. But the used AMI for the slave was taken from an once initialized slave. The jenkins ec2 plugin adds a marker file {{ ~/.hudson-run-init}} to ensure the init scripts only run once ... which meant the changes in the init script was never applied even on new slaves
Using an actual vanilla AMI did the trick.

Generated at Mon Feb 12 04:22:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.