Skip to content

Instantly share code, notes, and snippets.

@ericstoekl
Last active November 25, 2017 21:56
Show Gist options
  • Save ericstoekl/3d30624f9b7b78adcb1c2ca69d17c895 to your computer and use it in GitHub Desktop.
Save ericstoekl/3d30624f9b7b78adcb1c2ca69d17c895 to your computer and use it in GitHub Desktop.
Test the non-root template changes at https://github.com/openfaas/faas-cli/pull/91
#!/bin/bash
# Download all templates from branch
mkdir nonRootTest
cd nonRootTest
curl -sSL https://github.com/ericstoekl/faas-cli/archive/templateNonRoot.zip > tnr.zip
unzip tnr.zip 'faas-cli-templateNonRoot/template/*' -d .
mv faas-cli-templateNonRoot/template ./template
rm -r faas-cli-templateNonRoot
n1='nodefunction1'
c1='csharpfunction1'
r1='rubyfunction1'
p1='pythonfunction1'
p31='python3function1'
#Node
faas-cli new $n1 --lang node
faas-cli build -f $n1.yml
faas-cli deploy -f $n1.yml
#CS
faas-cli new $c1 --lang csharp
faas-cli build -f $c1.yml
faas-cli deploy -f $c1.yml
#Ruby
faas-cli new $r1 --lang ruby
faas-cli build -f $r1.yml
faas-cli deploy -f $r1.yml
#Python
faas-cli new $p1 --lang python
faas-cli build -f $p1.yml
faas-cli deploy -f $p1.yml
#Python3
faas-cli new $p31 --lang python
faas-cli build -f $p31.yml
faas-cli deploy -f $p31.yml
# Test all
echo "Sleep 40 seconds, then test node, csharp, ruby, and python functions (in order)"
sleep 40
echo "node test:"
echo -n "stuff" | faas-cli invoke $n1
echo "cs test:"
echo -n "stuff" | faas-cli invoke $c1
echo "ruby test:"
echo -n "stuff" | faas-cli invoke $r1
echo "python test:"
echo -n "stuff" | faas-cli invoke $p1
echo "python3 test:"
echo -n "stuff" | faas-cli invoke $p31
# Test that the lock file is present:
docker exec `docker container ps -a -f="status=running" | grep $n1 | awk '{print $1}'` whoami
docker exec `docker container ps -a -f="status=running" | grep $n1 | awk '{print $1}'` cat /tmp/.lock
echo "Lock file for $n1: error is $?"
docker exec `docker container ps -a -f="status=running" | grep $c1 | awk '{print $1}'` whoami
docker exec `docker container ps -a -f="status=running" | grep $c1 | awk '{print $1}'` cat /tmp/.lock
echo "Lock file for $c1: error is $?"
docker exec `docker container ps -a -f="status=running" | grep $r1 | awk '{print $1}'` whoami
docker exec `docker container ps -a -f="status=running" | grep $r1 | awk '{print $1}'` cat /tmp/.lock
echo "Lock file for $r1: error is $?"
docker exec `docker container ps -a -f="status=running" | grep $p1 | awk '{print $1}'` whoami
docker exec `docker container ps -a -f="status=running" | grep $p1 | awk '{print $1}'` cat /tmp/.lock
echo "Lock file for $p1: error is $?"
docker exec `docker container ps -a -f="status=running" | grep $p31 | awk '{print $1}'` whoami
docker exec `docker container ps -a -f="status=running" | grep $p31 | awk '{print $1}'` cat /tmp/.lock
echo "Lock file for $p31: error is $?"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment