Skip to content

Commit

Permalink
add script and yml file for integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Thiery Ouattara <[email protected]>
  • Loading branch information
outscale-toa committed Feb 4, 2022
1 parent 91c2be3 commit c3e8605
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Integration tests

on:
pull_request_target:
branches:
- master
workflow_dispatch:


jobs:
Integration_tests:
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.5.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_wrapper: false
- name: Build go test
run: make test
- name: Run integration tests
run: make test-integration
env:
OUTSCALE_ACCESSKEYID: ${{ secrets.OUTSCALE_ACCESSKEYID }}
OUTSCALE_SECRETKEYID: ${{ secrets.OUTSCALE_SECRETKEYID }}
OUTSCALE_REGION: ${{ secrets.OUTSCALE_REGION }}
OUTSCALE_ACCOUNT: ${{ secrets.OUTSCALE_ACCOUNT }}
OUTSCALE_IMAGEID: ${{ secrets.OUTSCALE_IMAGEID }}
5 changes: 3 additions & 2 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ test-compile:
exit 1; \
fi
go test -c $(TEST) $(TESTARGS)

test-integration:
@sh -c "'$(CURDIR)/scripts/integration.sh'"
website:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
Expand Down Expand Up @@ -81,4 +82,4 @@ examples-test:
cd ../..; \
done\

.PHONY: build test testacc fmt fmtcheck lint tools test-compile website website-lint website-test examples-test website-local
.PHONY: build test testacc fmt fmtcheck lint tools test-compile website website-lint website-test examples-test website-local test-integration
22 changes: 22 additions & 0 deletions scripts/integration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

set -e
project_dir=$(cd "$(dirname $0)" && pwd)
project_root=$(cd $project_dir/.. && pwd)
BUILD_DIR=$project_root/tests/qa_provider_oapi

python3 --version || (echo "We need 'python3' intalled to run integration tests"; exit 1)
python3 -m venv .venv
source .venv/bin/activate
pip --version || (echo "We need 'pip' intalled to run integration tests"; exit 1)

make fmt
make test
go build -o terraform-provider-outscale_v0.5.32
mkdir -p $BUILD_DIR/terraform.d/plugins/registry.terraform.io/outscale-dev/outscale/0.5.32/linux_amd64/
cp terraform-provider-outscale_v0.5.32 $BUILD_DIR/terraform.d/plugins/registry.terraform.io/outscale-dev/outscale/0.5.32/linux_amd64/

cd $BUILD_DIR
pip install -r requirements.txt
pytest -v ./test_provider_oapi.py
rm -fr terraform.d || exit 0

0 comments on commit c3e8605

Please sign in to comment.