Skip to content

Commit

Permalink
refacto local-tests.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
outscale-mgo committed Jul 30, 2024
1 parent 965bb5f commit 70a668f
Showing 1 changed file with 32 additions and 74 deletions.
106 changes: 32 additions & 74 deletions local_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,28 @@ export OSC_ACCESS_KEY=11112211111110000000

export OSC_USING_RICOCHET="oui"

function pulumi_up_dowm() {
set -eE

trap "echo [$MSG_BASE $1 pulumi up FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi up --yes
echo "[$MSG_BASE $1 pulumi up OK]"
trap "echo [$MSG_BASE python $1 down FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi down --yes
echo "[$MSG_BASE $1 pulumi down OK]"

set -e
}

function pulumi_setup_local() {
echo "pulumi set all stuffs"
pulumi config set outscale:secretKeyId $OSC_SECRET_KEY
pulumi config set outscale:accessKeyId $OSC_ACCESS_KEY
pulumi config set outscale:region "eu-west-2"
pulumi config set outscale:insecure true
pulumi config set outscale:endpoints '[{"api": "127.0.0.1:3000"}]'
}


if [ "$#" -eq 0 ]; then

Expand Down Expand Up @@ -66,23 +88,9 @@ pulumi stack init staging
pulumi stack select staging
set -e

echo "pulumi set all stuffs"
pulumi config set outscale:secretKeyId $OSC_SECRET_KEY
pulumi config set outscale:accessKeyId $OSC_ACCESS_KEY
pulumi config set outscale:region "eu-west-2"
pulumi config set outscale:insecure true
pulumi config set outscale:endpoints '[{"api": "127.0.0.1:3000"}]'

set -eE
pulumi_setup_local

trap "echo [$MSG_BASE yaml pulumi up FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi up --yes
echo "[$MSG_BASE yaml pulumi up OK]"
trap "echo [$MSG_BASE yaml pulumi down FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi down --yes
echo "[$MSG_BASE yaml pulumi down OK]"

set -e
pulumi_up_dowm "yaml"

echo "../python/"
cd ../python/
Expand All @@ -103,24 +111,13 @@ pulumi stack init staging
pulumi stack select staging
set -e

pulumi config set outscale:secretKeyId $OSC_SECRET_KEY
pulumi config set outscale:accessKeyId $OSC_ACCESS_KEY
pulumi config set outscale:region "eu-west-2"
pulumi config set outscale:insecure true
pulumi config set outscale:endpoints '[{"api": "127.0.0.1:3000"}]'
pulumi_setup_local

pip freeze

set -eE

trap "echo [$MSG_BASE python user pulumi up FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi up --yes
echo "[$MSG_BASE python user pulumi up OK]"
trap "echo [$MSG_BASE python user pulumi down FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi down --yes
echo "[$MSG_BASE python user pulumi down OK]"
pulumi_up_dowm "python user"

set -e
deactivate

cd ../hello/
Expand All @@ -137,25 +134,11 @@ pulumi stack init staging
pulumi stack select staging
set -e

pulumi config set outscale:secretKeyId $OSC_SECRET_KEY
pulumi config set outscale:accessKeyId $OSC_ACCESS_KEY
pulumi config set outscale:region "eu-west-2"
pulumi config set outscale:insecure true
pulumi config set outscale:endpoints '[{"api": "127.0.0.1:3000"}]'
pulumi_setup_local

pip freeze

set -eE

trap "echo [$MSG_BASE python hello pulumi up FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi up --yes
echo "[$MSG_BASE python hello pulumi up OK]"
trap "echo [$MSG_BASE python hello pulumi down FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi down --yes
echo "[$MSG_BASE python hello pulumi down OK]"

set +e
set -e
pulumi_up_dowm "python hello"

echo "../../ts/user/"
cd ../../ts/user/
Expand All @@ -168,23 +151,9 @@ set -e

npm install $GOPATH/sdk/nodejs/bin

pulumi config set outscale:secretKeyId $OSC_SECRET_KEY
pulumi config set outscale:accessKeyId $OSC_ACCESS_KEY
pulumi config set outscale:region "eu-west-2"
pulumi config set outscale:insecure true
pulumi config set outscale:endpoints '[{"api": "127.0.0.1:3000"}]'

set -eE
pulumi_setup_local

trap "echo [$MSG_BASE ty/js user pulumi up FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi up --yes
echo "[$MSG_BASE ty/js user pulumi up OK]"
trap "echo [$MSG_BASE ty/js user pulumi down FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi down --yes
echo "[$MSG_BASE ty/js user pulumi down OK]"

set +e
set -e
pulumi_up_dowm "ty/js user"

echo "../../go/vm/"
cd ../../go/vm/
Expand All @@ -195,17 +164,6 @@ pulumi stack init staging
pulumi stack select staging
set -e

pulumi config set outscale:secretKeyId $OSC_SECRET_KEY
pulumi config set outscale:accessKeyId $OSC_ACCESS_KEY
pulumi config set outscale:region "eu-west-2"
pulumi config set outscale:insecure true
pulumi config set outscale:endpoints '[{"api": "127.0.0.1:3000"}]'

set -eE
pulumi_setup_local

trap "echo [$MSG_BASE go/vm user pulumi up FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi up --yes
echo "[$MSG_BASE go/vm user pulumi up OK]"
trap "echo [$MSG_BASE go/vm user pulumi down FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi down --yes
echo "[$MSG_BASE go/vm user pulumi down OK]"
pulumi_up_dowm "go/vm"

0 comments on commit 70a668f

Please sign in to comment.