Files
fx-serverless/scripts/test_cli.sh
Minghe b569820d3e Provisioners (#495)
* seperate privisioners by platforms
* refactor provisioner
* fix image build
2020-03-19 21:53:31 +08:00

42 lines
708 B
Bash
Executable File

#!/usr/bin/env bash
set -e
fx="./build/fx"
service='fx-service'
run() {
local lang=$1
local port=$2
# localhost
$fx up --name ${service}_${lang} --port ${port} --healthcheck test/functions/func.${lang}
$fx list
$fx down ${service}_${lang}
}
build_image() {
local lang=$1
local name=$2
$fx image build -n ${name} test/functions/func.${lang}
}
export_image() {
local lang=$1
local dir=$2
$fx image export -o ${dir} test/functions/func.${lang}
}
# main
port=20000
for lang in ${1}; do
run $lang $port
((port++))
build_image $lang "test-fx-image-build-${lang}"
mkdir -p /tmp/${lang}/images
export_image ${lang} /tmp/${lang}/images
rm -rf /tmp/${lang}/images
done
wait