diff --git a/Makefile b/Makefile index b4a9ce78..a9b17e36 100644 --- a/Makefile +++ b/Makefile @@ -8,3 +8,6 @@ OPENSHIFT_NAMESPACES = .PHONY: $(shell test -f common/common.mk || echo >&2 'Please do "git submodule update --init" first.') include common/common.mk + +test-upstream-unittests: tag + VERSIONS=$(VERSIONS) TEST_UPSTREAM=yes common/test.sh diff --git a/test/run b/test/run index 69ab33de..3b3355da 100755 --- a/test/run +++ b/test/run @@ -106,23 +106,6 @@ if [ "$VERSION" -eq 14 ] ; then UNSTABLE_TESTS+=(test_client_faas) fi -readonly EXPRESS_REVISION="${EXPRESS_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show express version)}" -readonly EXPRESS_REPO="https://github.com/expressjs/express.git" -readonly PINO_REVISION=v"${PINO_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show pino version)}" -readonly PINO_REPO="https://github.com/pinojs/pino.git" -readonly PROMCLIENT_REVISION=v"${PROMCLIENT_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show prom-client version)}" -readonly PROMCLIENT_REPO="https://github.com/siimon/prom-client.git" -readonly OPOSSUM_REVISION="v${OPOSSUM_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show opossum version)}" -readonly OPOSSUM_REPO="https://github.com/nodeshift/opossum.git" -readonly KUBESERVICEBINDINGS_REVISION="v${KUBESERVICEBINDINGS_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show kube-service-bindings version)}" -readonly KUBESERVICEBINDINGS_REPO="https://github.com/nodeshift/kube-service-bindings.git" -readonly FAASJSRUNTIME_REVISION="v${FAASJSRUNTIME_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show faas-js-runtime version)}" -readonly FAASJSRUNTIME_REPO="https://github.com/nodeshift/faas-js-runtime.git" -readonly CLOUDEVENTS_REVISION="v${CLOUDEVENTS_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show cloudevents version)}" -readonly CLOUDEVENTS_REPO="https://github.com/cloudevents/sdk-javascript.git" -readonly FASTIFY_REVISION="v${FASTIFY_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show fastify version)}" -readonly FASTIFY_REPO="https://github.com/fastify/fastify.git" - source "${THISDIR}/test-lib.sh" source "${THISDIR}/test-lib-nodejs.sh" @@ -146,9 +129,7 @@ readonly -A gitconfig=( [commit.gpgsign]="false" ) -if [ "$DEBUG" != "" ]; then - set -x -fi +[[ -n "$DEBUG" ]] && set -x ct_init cid_file=$CID_FILE_DIR/$(mktemp -u -p . --suffix=.cid) @@ -183,6 +164,4 @@ ct_check_testcase_result $? TEST_SET=${TESTS:-$TEST_LIST_HW} ct_run_tests_from_testset "hw" -TEST_SET=${TESTS:-$TEST_LIST_CLIENTS} ct_run_tests_from_testset "clients" - TEST_SET=${TESTS:-$TEST_LIST_BINARY} ct_run_tests_from_testset "binary" diff --git a/test/run-upstream b/test/run-upstream new file mode 100755 index 00000000..64769885 --- /dev/null +++ b/test/run-upstream @@ -0,0 +1,66 @@ +#!/bin/bash +# +# IMAGE_NAME specifies a name of the candidate image used for testing. +# The image has to be available before this script is executed. +# +# For each client package test, XXX_REVISION specifies which +# branch or tag should be tested; by default it uses the latest +# released version as reported by `npm show XXX version` where +# XXX is the name of the npm package. +# +THISDIR="$(dirname ${BASH_SOURCE[0]})" +source "${THISDIR}/test-lib.sh" +source "${THISDIR}/test-lib-nodejs.sh" + +test -n "$IMAGE_NAME" -a -n "$VERSION" + +# define the client npm packages to be tested. For +# each entry XXX in the list a corresponding value for +# XXX_REVISION and XXX_REPO must be defined below +TEST_LIST_CLIENTS="\ +test_client_express +test_client_prom +test_client_opossum +test_client_kube +test_client_faas +test_client_cloudevents +test_client_fastify +" + +readonly EXPRESS_REVISION="${EXPRESS_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show express version)}" +readonly EXPRESS_REPO="https://github.com/expressjs/express.git" +readonly PINO_REVISION=v"${PINO_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show pino version)}" +readonly PINO_REPO="https://github.com/pinojs/pino.git" +readonly PROMCLIENT_REVISION=v"${PROMCLIENT_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show prom-client version)}" +readonly PROMCLIENT_REPO="https://github.com/siimon/prom-client.git" +readonly OPOSSUM_REVISION="v${OPOSSUM_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show opossum version)}" +readonly OPOSSUM_REPO="https://github.com/nodeshift/opossum.git" +readonly KUBESERVICEBINDINGS_REVISION="v${KUBESERVICEBINDINGS_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show kube-service-bindings version)}" +readonly KUBESERVICEBINDINGS_REPO="https://github.com/nodeshift/kube-service-bindings.git" +readonly FAASJSRUNTIME_REVISION="v${FAASJSRUNTIME_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show faas-js-runtime version)}" +readonly FAASJSRUNTIME_REPO="https://github.com/nodeshift/faas-js-runtime.git" +readonly CLOUDEVENTS_REVISION="v${CLOUDEVENTS_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show cloudevents version)}" +readonly CLOUDEVENTS_REPO="https://github.com/cloudevents/sdk-javascript.git" +readonly FASTIFY_REVISION="v${FASTIFY_REVISION:-$(docker run --rm "${IMAGE_NAME}" -- npm show fastify version)}" +readonly FASTIFY_REPO="https://github.com/fastify/fastify.git" + +# Since we built the candidate image locally, we don't want S2I attempt to pull +# it from a registry +s2i_args="--pull-policy=never " + +# TODO: This should be part of the image metadata +test_port=8080 + +# Common git configuration +readonly -A gitconfig=( + [user.name]="builder" + [user.email]="build@localhost" + [commit.gpgsign]="false" +) + +[[ -n "$DEBUG" ]] && set -x + +ct_init +cid_file=$CID_FILE_DIR/$(mktemp -u -p . --suffix=.cid) + +TEST_SET=${TESTS:-$TEST_LIST_CLIENTS} ct_run_tests_from_testset "clients"