Skip to content

Commit

Permalink
add test in action
Browse files Browse the repository at this point in the history
  • Loading branch information
rsonghuster committed Oct 17, 2024
1 parent 28df64a commit 1c1f861
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 119 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci_with_docker_linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

env:
REGION: cn-hongkong
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/ci_with_docker_macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- master
pull_request:
branches:
- master

env:
REGION: cn-hongkong
Expand Down
51 changes: 0 additions & 51 deletions __tests__/e2e/apt/code/package-lock.json

This file was deleted.

54 changes: 45 additions & 9 deletions __tests__/e2e/ci-mac-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
set -e
set -v

if [[ $(uname -s) == "Linux" ]]; then
# echo "test trigger"
# cd trigger && ./run
# cd ..
echo "test custom-domain"
cd custom-domain
s deploy -y
s info
s remove -y

s deploy -y -t s2.yaml
s info -t s2.yaml
s remove -y -t s2.yaml
cd ..
else
echo "skip test trigger"
fi

echo "test go runtime"
cd go
export fc_component_function_name=go1-$(uname)-$(uname -m)-$RANDSTR
Expand Down Expand Up @@ -40,15 +58,33 @@ s remove -y -t ./go/s.yaml
rm -rf ./go/code/target
cd ..

# echo "test nodejs runtime with auto ..."
# cd nodejs
# export fc_component_function_name=nodejs14-$(uname)-$(uname -m)-$RANDSTR
# s deploy -y -t ./s_auto.yaml
# s invoke -e '{"hello":"fc nodejs with auto"}' -t ./s_auto.yaml
# s info -y -t ./s_auto.yaml
# s remove -y -t ./s_auto.yaml
# cd ..
echo "test nodejs runtime with auto ..."
cd nodejs
export fc_component_function_name=nodejs14-$(uname)-$(uname -m)-$RANDSTR
s deploy -y -t s_auto.yaml
s invoke -e '{"hello":"fc nodejs with auto"}' -t s_auto.yaml
s info -y -t s_auto.yaml
s remove -y -t s_auto.yaml

echo "test deploy with alias"
export fc_component_function_name=nodejs14-$(uname)-$(uname -m)-$RANDSTR
s deploy --function -t s2.yaml
versionId=$(s version publish -t s2.yaml --silent -o json | jq -r '."versionId"')
echo "latest version = $versionId"
if [[ "$versionId" -gt 1 ]]; then
mainVersion=$((versionId - 1))
echo "main version = $mainVersion"
s alias publish --alias-name test --version-id $mainVersion --vw "{\"$versionId\": 0.2}" -t s2.yaml
else
s alias publish --alias-name test --version-id $versionId -t s2.yaml
fi

s deploy --trigger -t s2.yaml
s deploy --async-invoke-config -t s2.yaml
s info -t s2.yaml
s remove -y -t s2.yaml
cd ..

echo " ********* command-api *********"
cd command-api && ./run && cd -
cd command-api && ./run_cli_mode && cd -
cd command-api && ./run_cli_mode && cd -
2 changes: 1 addition & 1 deletion __tests__/e2e/custom-domain/s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: hello-world-app
access: "quanxi"

vars:
region: ${env('REGION', 'cn-huhehaote')}
region: 'cn-huhehaote'

resources:
hello_world_1:
Expand Down
51 changes: 0 additions & 51 deletions __tests__/e2e/nodejs/code/package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion __tests__/e2e/nodejs/s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: test-node-app # 项目名称
access: quanxi

vars:
region: ${env('REGION', 'cn-hangzhou')}
region: ${env('REGION', 'cn-huhehaote')}

resources:
fcDemo: # 业务名称/模块名称
Expand Down
22 changes: 22 additions & 0 deletions __tests__/e2e/trigger/run
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,26 @@ s deploy -y
s info
s plan
s remove -y

echo "test http trigger with jwt ..."
cd ../jwt
export fc_component_function_name=nodejs16-$(uname)-$(uname -m)-$RANDSTR
s deploy -y -t ./s.yaml
s invoke -e '{"hello":"fc http trigger with jwt"}' -t ./s.yaml
url1=$(s info -y -t ./s.yaml --silent -o json | jq -r '.hello_world.url.system_url')
url2=$(s info -y -t ./s.yaml --silent -o json | jq -r '.hello_world_2.url.system_url')
echo $url1
echo $url2
curl -XPOST $url1/black1/aa -d '{"test":"jwt"}'
curl -XPOST $url1/black2/aaa -d '{"test":"jwt"}'
curl -XPOST $url1/black1/bbb -d '{"test":"jwt"}'
curl -XPOST $url1/black1/bbb -d '{"test":"jwt"}' -H "Authentication: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiIsImFkbWluIjp0cnVlLCJleHAiOjE3MDkxODg1MzksIm5iZiI6MTcwOTAxNTc1NCwiaWF0IjoxNzA5MDE1NzU2fQ.LknspC5W2QEThq9xpF1OciAJKpQMJmhkPGRWCS4rRoEeyTYl7bzKLqTuEhKE1I-luzjjIXNsnK6Ypbk_ith5mV2Wz6TTfQ-BF_dfBEfx75A9lDaTyLrn_zNLlOs-qsxst2y7eAOQQ7lb2mubFlLA3LDAWO-4UBJDLes0Mn6rp5pzSbF5zNypd319J1R6gAGBUBsPFGeTkxjr3ykHlB_nKNV0G7WpK9z_QvXQkT4os3oU2rs2tL1QQO4P3pSDB2lvEJ0dsXVggJi1rr6Av22uDI1lFo0PEekJmdFns-VIS36ipy3Ppgd7f5gicBNgUyhNUggPbdyePfV7zCkw3IrU-w"
curl -XPOST $url1/black1/bbb -d '{"test":"jwt"}' -H "Authentication: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Ind3dy5iZWpzb24uY29tIiwic3ViIjoiZGVtbyIsImlhdCI6MTcwOTAxOTM5MCwibmJmIjoxNzA5MDE5MzkwLCJleHAiOjE3MDkxMDU3OTB9.TmHPtcD76VBNelt0Qdjc-SsYxfpxIzNIL0FSz8JAQchhqkXnhpqK5j2_sE0ot6Fx_bwFQHEB0erJLn4Ey7OtJgT4B3etxlpcw39jk2M1YidkFfKHgq2d8tUXa-Nu8mpvVQP7kQJ-Z-l_OkiJZs1NpgaKo5646k0vEaQqmzW3aYwuL4NE2tumDoYDCzexLzUTuzNUucxZ8sZYqf5_yIcLXueHItGampnLMtsWLNH3StXoiQWkS79Lhj04Lq5YTO4Sd074KNc5juJRZwqNpjddaQ08_5ry_jhOr0C3c1uEatehCePJozQZIdELf0Y6gN0-CYRhcJPiz5ynbOB9pNMLUw"
curl -XPOST $url2/white1/aaa -d '{"test":"jwt"}'
curl -XPOST $url2/white2/ccc -d '{"test":"jwt"}'
curl -XPOST $url2/common/aaa -d '{"test":"jwt"}' -H "Authentication: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiSm9obiIsImFkbWluIjp0cnVlLCJleHAiOjE3MDkxODg1MzksIm5iZiI6MTcwOTAxNTc1NCwiaWF0IjoxNzA5MDE1NzU2fQ.LknspC5W2QEThq9xpF1OciAJKpQMJmhkPGRWCS4rRoEeyTYl7bzKLqTuEhKE1I-luzjjIXNsnK6Ypbk_ith5mV2Wz6TTfQ-BF_dfBEfx75A9lDaTyLrn_zNLlOs-qsxst2y7eAOQQ7lb2mubFlLA3LDAWO-4UBJDLes0Mn6rp5pzSbF5zNypd319J1R6gAGBUBsPFGeTkxjr3ykHlB_nKNV0G7WpK9z_QvXQkT4os3oU2rs2tL1QQO4P3pSDB2lvEJ0dsXVggJi1rr6Av22uDI1lFo0PEekJmdFns-VIS36ipy3Ppgd7f5gicBNgUyhNUggPbdyePfV7zCkw3IrU-w"
curl -XPOST $url2/common/aaa -d '{"test":"jwt"}' -H "Authentication: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6Ind3dy5iZWpzb24uY29tIiwic3ViIjoiZGVtbyIsImlhdCI6MTcwOTAxOTM5MCwibmJmIjoxNzA5MDE5MzkwLCJleHAiOjE3MDkxMDU3OTB9.TmHPtcD76VBNelt0Qdjc-SsYxfpxIzNIL0FSz8JAQchhqkXnhpqK5j2_sE0ot6Fx_bwFQHEB0erJLn4Ey7OtJgT4B3etxlpcw39jk2M1YidkFfKHgq2d8tUXa-Nu8mpvVQP7kQJ-Z-l_OkiJZs1NpgaKo5646k0vEaQqmzW3aYwuL4NE2tumDoYDCzexLzUTuzNUucxZ8sZYqf5_yIcLXueHItGampnLMtsWLNH3StXoiQWkS79Lhj04Lq5YTO4Sd074KNc5juJRZwqNpjddaQ08_5ry_jhOr0C3c1uEatehCePJozQZIdELf0Y6gN0-CYRhcJPiz5ynbOB9pNMLUw"
s plan -t ./s.yaml
s info -y -t ./s.yaml
s remove -y -t ./s.yaml
cd ..

0 comments on commit 1c1f861

Please sign in to comment.