camel-k icon indicating copy to clipboard operation
camel-k copied to clipboard

Cannot run `make test-smoke` on arm64 out of the box

Open tdiesler opened this issue 4 months ago • 4 comments

What happened?

It seems that make test-smoke makes incorrect assumptions about the underlying architecture. The TestRunPolyglotExamples is the first that I see failing because of an invalid exec format, which in turn is because of an incorrect base image: -Djib.from.image=eclipse-temurin:17

Related to https://github.com/apache/camel-k/issues/5292 I would assume that this is somehow supposed to set the -t builder.platforms trait, which would then add -Djib.from.platforms=linux/arm64

Is there perhaps an (undocumented) trick to make this work with the current code base?

Alternatively, please give advice on how we can enable that trait without too much duplication. Perhaps scoped on the operator install step or a more global scope e.g. go test ... or an even more global scope e.g. envar

tdiesler avatar Apr 12 '24 12:04 tdiesler

yes, you need to set some environment variables to overwrite the base image. These are the environment variables you may want to set.

CAMEL_K_TEST_OPERATOR_IMAGE
CAMEL_K_TEST_BASE_IMAGE
CAMEL_K_TEST_RUNTIME_VERSION
CAMEL_K_TEST_OPERATOR_IMAGE_PULL_POLICY
CAMEL_K_TEST_LOG_LEVEL
CAMEL_K_TEST_MAVEN_CLI_OPTIONS
CAMEL_K_TEST_MAVEN_CA_PEM_PATH

For arm64 platforms you may need to set at least CAMEL_K_TEST_OPERATOR_IMAGE and CAMEL_K_TEST_BASE_IMAGE

It would be good to have this part of the documentation

christophd avatar Apr 12 '24 14:04 christophd

Thanks, we probably want a similar envar logic for these as we have for the build - I'll suggest something

tdiesler avatar Apr 15 '24 09:04 tdiesler

I made a simple change to test_support that adds the the missing -t builder.platforms trait when on arm64 and not given already, as well as a simple wrapper script that sets the required CAMEL_K_TEST_* envars when on arm64

Create sub-shell

 ./script/e2e_env.sh shell
 $ go test -v -tags=integration ./e2e/common/languages/java_test.go

Run a command in this environment

 ./script/e2e_env.sh run go test -v -tags=integration ./e2e/common/languages/java_test.go

PR: https://github.com/apache/camel-k/pull/5370

tdiesler avatar Apr 15 '24 12:04 tdiesler

For reference, on MacOS M2, 24G Ram, 8 Core

> time TEST_COMMON_PARALLEL_COUNT=2 make test-smoke | tee build/_output/test-smoke.out
TEST_COMMON_PARALLEL_COUNT=2 make test-smoke  17.41s user 6.80s system 1% cpu 27:34.82 total

tdiesler avatar Apr 17 '24 14:04 tdiesler

This should be out-of-date, now that the platform uses an arch specific default

> time TEST_COMMON_PARALLEL_COUNT=2 make test-smoke | tee build/_output/test-smoke.out
TEST_COMMON_PARALLEL_COUNT=2 make test-smoke  29.63s user 7.47s system 1% cpu 31:36.46 total

tdiesler avatar May 08 '24 09:05 tdiesler