From 728f4d8f065d11d5b1088c7f7b858efe1b2a4484 Mon Sep 17 00:00:00 2001 From: bzp2010 Date: Wed, 24 Nov 2021 17:08:07 +0800 Subject: [PATCH] feat: prepare block for env --- ci/linux-ci-init-service.sh | 6 ------ t/plugin/openwhisk.t | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/ci/linux-ci-init-service.sh b/ci/linux-ci-init-service.sh index 83144b7b3b30a..0d15d06042e04 100755 --- a/ci/linux-ci-init-service.sh +++ b/ci/linux-ci-init-service.sh @@ -19,9 +19,3 @@ docker exec -i apache-apisix_kafka-server1_1 /opt/bitnami/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper-server1:2181 --replication-factor 1 --partitions 1 --topic test2 docker exec -i apache-apisix_kafka-server1_1 /opt/bitnami/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper-server1:2181 --replication-factor 1 --partitions 3 --topic test3 docker exec -i apache-apisix_kafka-server2_1 /opt/bitnami/kafka/bin/kafka-topics.sh --create --zookeeper zookeeper-server2:2181 --replication-factor 1 --partitions 1 --topic test4 - -# prepare openwhisk env -docker pull openwhisk/action-nodejs-v14:nightly -docker run --rm -d --name openwhisk -p 3233:3233 -p 3232:3232 -v /var/run/docker.sock:/var/run/docker.sock openwhisk/standalone:nightly -docker exec -i openwhisk waitready -docker exec -i openwhisk bash -c "wsk action update test <(echo 'function main(args){return {\"hello\":args.name || \"test\"}}') --kind nodejs:14" diff --git a/t/plugin/openwhisk.t b/t/plugin/openwhisk.t index e20fe5a5547e8..53f09247bc3f2 100644 --- a/t/plugin/openwhisk.t +++ b/t/plugin/openwhisk.t @@ -32,6 +32,27 @@ add_block_preprocessor(sub { } }); +# Start OpenWhisk environment +BEGIN { + # Prepull nodejs runtime image + `docker pull openwhisk/action-nodejs-v14:nightly`; + + # Start OpenWhisk + my $output = `docker run -d -h openwhisk --name openwhisk -p 3233:3233 -p 3232:3232 -v /var/run/docker.sock:/var/run/docker.sock openwhisk/standalone:nightly`; + warn "$output"; + my $output = `docker exec -i openwhisk waitready`; + warn "$output"; + + # Create test action + my $output = `docker exec -i openwhisk bash -c "wsk action update test <(echo 'function main(args){return {\"hello\":args.name || \"test\"}}') --kind nodejs:14"`; + warn "$output"; +} + +# Cleanup OpenWhisk environment +END { + `docker stop openwhisk` +} + run_tests(); __DATA__