Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: java and python templates are broken (aws#17357)
There are two problems. ### Python The `app` template doesn't define any tests (it does, but they are commented out), this makes `pytest` fail during our integ tests: ```console ============================= test session starts ============================== 970 | platform linux -- Python 3.7.3, pytest-6.2.5, py-1.11.0, pluggy-1.0.0 971 | rootdir: /tmp/cdk-init-test 972 | collected 0 items 973 | 974 | ============================ no tests ran in 0.01s ============================= 975 | + run_traps 976 | + for cmd in "${TRAPS[@]}" 977 | + echo 'cleanup: kill 121' 978 | cleanup: kill 121 979 | + eval 'kill 121' 980 | ++ kill 121 981 | + for cmd in "${TRAPS[@]}" 982 | + echo 'cleanup: clean_up_nuget_config' 983 | cleanup: clean_up_nuget_config 984 | + eval clean_up_nuget_config 985 | ++ clean_up_nuget_config 986 | ++ log 'Restoring NuGet configuration' 987 | ++ echo '\| Restoring NuGet configuration' 988 | \| Restoring NuGet configuration 989 | ++ '[' -f /root/.nuget/NuGet/NuGet.Config.bak ']' 990 | ++ log '-> Removing /root/.nuget/NuGet/NuGet.Config' 991 | ++ echo '\| -> Removing /root/.nuget/NuGet/NuGet.Config' 992 | \| -> Removing /root/.nuget/NuGet/NuGet.Config 993 | ++ rm -f /root/.nuget/NuGet/NuGet.Config 994 | 995 | [Container] 2021/11/05 05:05:43 Command did not exit successfully /bin/bash /tmp/scriptdir/cdk/init-templates/dispatch.sh exit status 5 996 | [Container] 2021/11/05 05:05:43 Phase complete: BUILD State: FAILED 997 | [Container] 2021/11/05 05:05:43 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: /bin/bash /tmp/scriptdir/cdk/init-templates/dispatch.sh. Reason: exit status 5 998 | [Container] 2021/11/05 05:05:43 Entering phase POST_BUILD 999 | [Container] 2021/11/05 05:05:43 Phase complete: POST_BUILD State: SUCCEEDED 1000 | [Container] 2021/11/05 05:05:43 Phase context status code: Message: 1001 <br class="Apple-interchange-newline"> ``` Solution is to uncomment the test method signature and making it an empty test, just like we do with typescript. ### Java `Map.of` doesn't exist in Java 8 and we are getting complication errors during `mvn package`: ```console [INFO] ------------------------------------------------------------- -- 1018 | [ERROR] COMPILATION ERROR : 1019 | [INFO] ------------------------------------------------------------- 1020 | [ERROR] /tmp/cdk-init-test/src/test/java/com/myorg/CdkInitTestStackTest.java:[21,62] cannot find symbol 1021 | symbol: method of(java.lang.String,int) 1022 | location: interface java.util.Map 1023 | [INFO] 1 error ``` Solution is to replace `Map.of` with `new HashMap` that is supported everywhere. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information