Skip to content

Commit

Permalink
make upstream tests as separate make target
Browse files Browse the repository at this point in the history
  • Loading branch information
zmiklank committed Nov 10, 2023
1 parent afdbf59 commit e9ca100
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 22 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 1 addition & 22 deletions test/run
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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)
Expand Down Expand Up @@ -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"
66 changes: 66 additions & 0 deletions test/run-upstream
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit e9ca100

Please sign in to comment.