我正在尝试在我的薄荷笔记本电脑上安装 ovirt。
在 debian 发行版上安装 oVirt 是实验性的,并且网上关于故障排除的知识很少。
但是,我已经找到了问题的根源,只是不知道如何解决它。
失败的maven测试输出如下:
-------------------------------------------------------------------------------
Test set: org.ovirt.engine.core.branding.BrandingManagerTest
-------------------------------------------------------------------------------
Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.249 sec <<< FAILURE!
testGetMessageDefaultLocale(org.ovirt.engine.core.branding.BrandingManagerTest) Time elapsed: 0.016 sec <<< FAILURE!
org.junit.ComparisonFailure: The result should be 'Main header' expected:<Main header[]> but was:<Main header[(fr)]>
at org.junit.Assert.assertEquals(Assert.java:115)
at org.ovirt.engine.core.branding.BrandingManagerTest.testGetMessageDefaultLocale(BrandingManagerTest.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:35)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:115)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
at com.sun.proxy.$Proxy0.invoke(Unknown Source)
at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
注意第六行:The result should be 'Main header' expected:<Main header[]> but was:<Main header[(fr)]>
看来测试因字符串不匹配而失败,可能是因为我的 Linux 安装的是法语。我想找到一种方法来强制安装仅以英文安装以避免这种情况。我尝试过 addindBUILD-LOCALES="en"
但没有解决问题。
有任何想法吗?
答案1
因此,您正确地假设问题在于您的 linux 是法语,这导致 JVM 的默认区域设置也是法语。但是,单元测试假定默认值为 en_US 作为默认区域设置(因为它在测试运行开始时未将区域设置显式设置为 en_US)。
要在您的特定情况下解决此问题,您可以将其传递给 make run:
DEV_EXTRA_BUILD_FLAGS='-Duser.country=US -Duser.language=en' 应该在运行测试时将语言环境传递给 JVM,并使其加载正确的属性进行测试。