Skip to content

Commit

Permalink
Fix test by make sorting independent of locale and case (#9640)
Browse files Browse the repository at this point in the history
* Install requited locale in container image

One of the IMAP tests curiuosly ran successfully on Github-runners, but
failed locally. This is the pre-condition for a fix.

* Explicitly require mandatory locale for test

This test works only if executed with LC_COLLATE=en_US

* Schedule to rebuild testrunner image each week
  • Loading branch information
pabzm committed Sep 19, 2024
1 parent 3cff118 commit d31c536
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .ci/docker-images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ RUN apt-get update \
aspell-de \
hunspell-en-us \
git \
locales \
&& apt-get clean

# Some tests require en_US.UTF-8 as locale.
RUN sed -i 's/^# en_US.UTF-8 /en_US.UTF-8 /' /etc/locale.gen && locale-gen

# TODO: Do we need the multiarch-args? What for?
#RUN debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \
RUN docker-php-ext-configure gd --with-jpeg --with-freetype \
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/docker_image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
paths:
- '.ci/docker-images/*'
- '.github/workflows/docker_image.yml'
schedule:
# Rebuild automatically each monday early morning.
- cron: "42 5 * * 1"

jobs:
build_and_push:
Expand Down
5 changes: 5 additions & 0 deletions tests/Framework/ImapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public function test_convert_criteria()
*/
public function test_sort_folder_list()
{
// The sorting requires this locale.
if (setlocale(\LC_ALL, 'en_US.UTF-8', 'en_US.utf8', 'en_US', 'en-US') === false) {
throw new \Error('This test requires `en_US` to be settable as locale, but those appear to not be present in your environment!');
}

$_SESSION['imap_delimiter'] = '.';
$_SESSION['imap_namespace'] = [
'personal' => null,
Expand Down

0 comments on commit d31c536

Please sign in to comment.