运行 AWS CodeBuild 上带有类路径的独立 jar 通过,但测试实际上没有通过 运行

Running standalone jar with classpath on AWS CodeBuild passes but tests don't actually run

我正在使用 描述的策略 ​​运行 独立 karate.jar 以及自定义 jar(实现 LogModifier):

java -cp karate.jar:seesaw-karate.jar:./tests/java com.intuit.karate.Main ./tests/api

这在我的本地机器上运行良好,但在 AWS CodeBuild 上 运行ning 时看到奇怪的行为:测试报告通过,但耗时 0 秒并且没有显示输出,表明它们实际上不是 运行宁.

CodeBuild 作业在 /aws/codebuild/standard:3.0 图像上的 openjdk11 上 运行ning。 java -version 报告:

openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)

为了比较我的本地环境:

java version "12.0.2" 2019-07-16
Java(TM) SE Runtime Environment (build 12.0.2+10)
Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing)

注意:我们之前 运行 java -jar karate.jar 并且在相同的 CodeBuild 环境中成功运行。我的理解是我们需要执行类路径方法来包含多个 jar 文件(我们需要这样做才能使用 LogModifier)。如果有更好的方法请指正!

以下是容器中的一些日志:

[Container] 2021/03/10 01:31:46 Running command java -Dkarate.config.dir=$RELOADED_DIR/exp/ss2_gql/tests/api/config -Dss2GqlUri=$RELOADED_HTTP_URL -DwsUri=$RELOADED_WS_URL -cp "${RELOADED_DIR}/exp/ss2_gql/karate.jar:${RELOADED_DIR}/exp/ss2_gql/seesaw-karate.jar:${RELOADED_DIR}/exp/ss2_gql/tests/java" com.intuit.karate.Main $RELOADED_DIR/exp/ss2_gql/tests/api --tags ~@ignore -o .karate-output
01:31:50.265 [main]  INFO  com.intuit.karate.Main - Karate version: 0.9.6
Warning: Nashorn engine is planned to be removed from a future JDK release
01:31:51.993 [main]  INFO  com.intuit.karate.Runner - waiting for parallel features to complete ...
01:31:52.741 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 1 of 25: 01/exp/ss2_gql/tests/api/conversation_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/conversation_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.conversation_test.json
scenarios:  9 | passed:  9 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.752 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 2 of 25: 01/exp/ss2_gql/tests/api/migrate_conversation_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/migrate_conversation_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.migrate_conversation_test.json
scenarios:  1 | passed:  1 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.761 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 3 of 25: 01/exp/ss2_gql/tests/api/conv_search.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/conv_search.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.conv_search.json
scenarios:  1 | passed:  1 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.788 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 5 of 25: 01/exp/ss2_gql/tests/api/org_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/org_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.org_test.json
scenarios:  4 | passed:  4 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.829 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 22 of 25: 01/exp/ss2_gql/tests/api/message_notifications_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/message_notifications_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.message_notifications_test.json
scenarios:  1 | passed:  1 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.846 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 23 of 25: 01/exp/ss2_gql/tests/api/auth_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/auth_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.auth_test.json
scenarios:  2 | passed:  2 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.858 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 24 of 25: 01/exp/ss2_gql/tests/api/update_conversation_read_status_test.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/update_conversation_read_status_test.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.update_conversation_read_status_test.json
scenarios:  2 | passed:  2 | failed:  0 | time: 0.0000
---------------------------------------------------------
01:31:52.908 [pool-1-thread-1]  INFO  com.intuit.karate.Runner - <<pass>> feature 25 of 25: 01/exp/ss2_gql/tests/api/people_search.feature
---------------------------------------------------------
feature: 01/exp/ss2_gql/tests/api/people_search.feature
report: .karate-output/surefire-reports/01.exp.ss2_gql.tests.api.people_search.json
scenarios: 11 | passed: 11 | failed:  0 | time: 0.0000
---------------------------------------------------------

HTML report: (paste into browser to view) | Karate version: 0.9.6
file:/codebuild/output/src992/src/s3/00/.karate-output/surefire-reports/karate-summary.html
===================================================================

Karate version: 0.9.6
======================================================
elapsed:   2.43 | threads:    1 | thread time: 0.00 
features:     8 | ignored:   17 | efficiency: 0.00
scenarios:   31 | passed:    31 | failed: 0
======================================================

好的,你能再试试 1.0 RC 系列吗,因为这已经接近最终版本了,我们正在集中精力开发:https://github.com/intuit/karate/wiki/1.0-upgrade-guide

因为我猜这是一个 JDK 兼容性问题,我们希望新的解决它。您开始使用新版本进行测试也很重要,这样我们就有机会修复您可能发现的任何其他漏洞。