Skip to content

Commit

Permalink
feat: prepare block for env
Browse files Browse the repository at this point in the history
  • Loading branch information
bzp2010 committed Nov 24, 2021
1 parent 85eeb9e commit 728f4d8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
6 changes: 0 additions & 6 deletions ci/linux-ci-init-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
21 changes: 21 additions & 0 deletions t/plugin/openwhisk.t
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down

0 comments on commit 728f4d8

Please sign in to comment.