Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit Tests failed #21001

Closed
azngeek opened this issue Feb 5, 2019 · 12 comments
Closed

Unit Tests failed #21001

azngeek opened this issue Feb 5, 2019 · 12 comments
Assignees
Labels
Component: StaticTest Event: snowdog-oss Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@azngeek
Copy link

azngeek commented Feb 5, 2019

Summary

The unit tests fails for the FormatTests.

Environment

PHP 7.2.14 (cli) (built: Jan 22 2019 22:37:37) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.14, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans

Preconditions (*)

  1. magento/project-enterprise-edition 2.3.0
  2. Dockerfile using PHP 7.2 and all required extensions
FROM php:7.2-fpm

# Install dependencies
RUN apt-get update \
  && apt-get install -y \
    libfreetype6-dev \
    libicu-dev \
    libjpeg62-turbo-dev \
    libmcrypt-dev \
    libpng-dev \
    libxslt1-dev \
    sendmail-bin \
    sendmail \
    sudo \
    wget

# Configure the gd library
RUN docker-php-ext-configure \
  gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/

# Install required PHP extensions
RUN docker-php-ext-install dom gd intl mbstring pdo_mysql xsl zip bcmath soap sockets opcache

RUN pecl install -o -f xdebug


###############################
# z.sh                        #
###############################
RUN wget --no-check-certificate https://raw.github.com/rupa/z/master/z.sh -O /usr/local/bin/z.sh && \
chmod +x /usr/local/bin/z.sh && \
echo '. /usr/local/bin/z.sh' >> /root/.bashrc

###############################
# codecept.phar                #
###############################
RUN curl -sL http://codeception.com/codecept.phar -o /usr/local/bin/codecept \
    && chmod +x /usr/local/bin/codecept

# magerun.phar                #
###############################
RUN curl -sL https://files.magerun.net/n98-magerun2.phar -o /usr/local/bin/magerun \
    && chmod +x /usr/local/bin/magerun



#ADD ./conf.d/mothership.ini /usr/local/etc/php/conf.d/mothership.ini
#ADD ./conf.d/sendmail.ini /usr/local/etc/php/conf.d/sendmail.ini
#ADD ./etc/ssmtp/ssmtp.conf /etc/ssmtp/ssmtp.conf

#RUN apk del .build-deps && \
#    rm -rf /tmp/*

RUN apt-get install -y locales locales-all
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

WORKDIR /var/www/share/dev/

Steps to reproduce (*)

  1. Launch Container and mount Magento with all dependencies to /var/www/share/dev/htdocs/www/
  2. Change directory und run tests in container
cd /var/www/share/dev/htdocs/www/vendor/magento/framework/Locale/Test/Unit
 /var/www/share/dev/htdocs/www/./vendor/phpunit/phpunit/phpunit FormatTest.php

Expected result (*)

  1. Unit Test should run

Actual result (*)

  1. Unit Test fails
3) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #1 ('de_DE', array(',', '.'))
Failed asserting that actual size 0 matches expected size 2.

/var/www/share/dev/htdocs/www/vendor/magento/framework/Locale/Test/Unit/FormatTest.php:82

4) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #2 ('de_CH', array('.', '''))
Failed asserting that actual size 1 matches expected size 2.

/var/www/share/dev/htdocs/www/vendor/magento/framework/Locale/Test/Unit/FormatTest.php:82

5) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #3 ('uk_UA', array(',', ' '))
Failed asserting that actual size 0 matches expected size 2.

Observations

From what i can see right now the error occurs in the class \Magento\Framework\Locale\Magento\Framework\Locale. If i remove the part with "@Currency=' . $currency->getCode()", the tests will pass. It might be an issue with icu.

    /**
     * Returns an array with price formatting info
     *
     * @param string $localeCode Locale code.
     * @param string $currencyCode Currency code.
     * @return array
     */
    public function getPriceFormat($localeCode = null, $currencyCode = null)
    {
        $localeCode = $localeCode ?: $this->_localeResolver->getLocale();
        if ($currencyCode) {
            $currency = $this->currencyFactory->create()->load($currencyCode);
        } else {
            $currency = $this->_scopeResolver->getScope()->getCurrentCurrency();
        }

        $formatter = new \NumberFormatter(
            $localeCode . '@currency=' . $currency->getCode(),
            \NumberFormatter::CURRENCY
        );
        $format = $formatter->getPattern();

ICU Details

/var/www/share/dev/htdocs/www$ php -i |grep ICU
ICU version => 57.1
ICU Data version => 57.1
ICU TZData version => 2016b
ICU Unicode version => 8.0
@magento-engcom-team
Copy link
Contributor

Hi @azngeek. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@azngeek do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Feb 5, 2019
@ghost ghost self-assigned this Feb 6, 2019
@magento-engcom-team
Copy link
Contributor

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • Next steps are available in case you are a member of Community Maintainers.

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@ghost
Copy link

ghost commented Feb 6, 2019

Hi @azngeek thank you for you report i'm not able to reproduce following steps you described on clean magento 2.3-dev instance
selection_318

@ghost ghost closed this as completed Feb 6, 2019
@azngeek
Copy link
Author

azngeek commented Feb 6, 2019

Hey,

i don't think that this issue should be closed. I was able to easily reproduce it with my environment. The implementation used heavily depends on using the right ICU library. In my case this works with ICU Version 52.1. Might also be the one which is used in Travis.

If you use a newer version (which is the case in newer linux distributions), this test will fail.

@ghost
Copy link

ghost commented Feb 8, 2019

@azngeek ok, i'm will try with newer version

@jonashrem
Copy link
Contributor

jonashrem commented Feb 8, 2019

I was able to reproduce this bug as well on ubuntu 18.04 with a fresh installed magento 2.3.0 (libicu 60.2)


phpunit  FormatTest.php
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

.FFF..........                                                    14 / 14 (100%)

Time: 59 ms, Memory: 6.00MB

There were 3 failures:

1) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #1 ('de_DE', array(',', '.'))
Failed asserting that actual size 0 matches expected size 2.

/var/www/share/magento2.maxcluster.de/2.3.0/vendor/magento/framework/Locale/Test/Unit/FormatTest.php:82

2) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #2 ('de_CH', array('.', '''))
Failed asserting that actual size 1 matches expected size 2.

/var/www/share/magento2.maxcluster.de/2.3.0/vendor/magento/framework/Locale/Test/Unit/FormatTest.php:82

3) Magento\Framework\Locale\Test\Unit\FormatTest::testGetPriceFormat with data set #3 ('uk_UA', array(',', ' '))
Failed asserting that actual size 0 matches expected size 2.
/var/www/share/magento2.maxcluster.de/2.3.0/vendor/magento/framework/Locale/Test/Unit/FormatTest.php:82

FAILURES!
Tests: 14, Assertions: 15, Failures: 3.

I made the same test on Debian 8 for comparison (libicu 52.1)

phpunit  FormatTest.php
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

..............                                                    14 / 14 (100%)

Time: 63 ms, Memory: 6.00MB

OK (14 tests, 18 assertions)

@jonashrem
Copy link
Contributor

When printing out Result and Expected Result, you see that decimalSymbol and groupSymbol are always the local ones.

.Result
Array
(
    [pattern] => 
    [precision] => 2
    [requiredPrecision] => 2
    [decimalSymbol] => .
    [groupSymbol] => ,
    [groupLength] => 3
    [integerRequired] => 
)
Expected Result
Array
(
    [decimalSymbol] => .
    [groupSymbol] => ,
)
FResult
Array
(
    [pattern] => 
    [precision] => 2
    [requiredPrecision] => 2
    [decimalSymbol] => .
    [groupSymbol] => ,
    [groupLength] => 3
    [integerRequired] => 
)
Expected Result
Array
(
    [decimalSymbol] => ,
    [groupSymbol] => .
)
FResult
Array
(
    [pattern] => 
    [precision] => 2
    [requiredPrecision] => 2
    [decimalSymbol] => .
    [groupSymbol] => ,
    [groupLength] => 3
    [integerRequired] => 
)
Expected Result
Array
(
    [decimalSymbol] => .
    [groupSymbol] => '
)
FResult
Array
(
    [pattern] => 
    [precision] => 2
    [requiredPrecision] => 2
    [decimalSymbol] => .
    [groupSymbol] => ,
    [groupLength] => 3
    [integerRequired] => 
)
Expected Result
Array
(
    [decimalSymbol] => ,
    [groupSymbol] =>  
)

@jonashrem jonashrem reopened this Feb 8, 2019
@ghost ghost added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Component: StaticTest Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Feb 12, 2019
@magento-engcom-team
Copy link
Contributor

✅ Confirmed by @engcom-backlog-nazar
Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-98221, MAGETWO-98222 were created

Issue Available: @engcom-backlog-nazar, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Feb 12, 2019
@kdegorski
Copy link
Contributor

#snowdog-oss

@magento-engcom-team
Copy link
Contributor

@kdegorski thank you for joining. Please accept team invitation here and self-assign the issue.

@magento-engcom-team
Copy link
Contributor

Hi @kdegorski. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

kdegorski added a commit to kdegorski/magento2 that referenced this issue Mar 21, 2019
…er, then it behaves as was expected in test.
kdegorski added a commit to kdegorski/magento2 that referenced this issue Mar 21, 2019
…er, then it behaves as was expected in test.
kdegorski added a commit to kdegorski/magento2 that referenced this issue Mar 22, 2019
@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Mar 26, 2019
@magento-engcom-team
Copy link
Contributor

Hi @azngeek. Thank you for your report.
The issue has been fixed in #21880 by @kdegorski in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.2 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: StaticTest Event: snowdog-oss Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

4 participants