-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #166 from microsoft/system-tests
Add system level testing which can be run locally and in C-ACI
- Loading branch information
Showing
54 changed files
with
1,585 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
name: "KMS CI" | ||
name: CI | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
on: | ||
push: | ||
|
@@ -8,46 +12,51 @@ on: | |
workflow_dispatch: | ||
|
||
jobs: | ||
kms: | ||
name: kms | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build DevContainer | ||
uses: devcontainers/[email protected] | ||
with: | ||
push: never | ||
configFile: .devcontainer/devcontainer.json | ||
runCmd: | | ||
scripts/set_python_env.sh && pip install -r requirements.txt && make demo && npm run test | ||
env: | ||
KMS_WORKSPACE: ./workspace | ||
- name: Run Lint | ||
run: make lint | ||
|
||
test-mccf-kms: | ||
runs-on: ubuntu-20.04 | ||
unit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Test mCCF KMS | ||
run: | | ||
. ./scripts/setup_mCCF.sh | ||
./scripts/test_curl.sh | ||
- name: Install Dependencies | ||
env: | ||
PUBLIC_CERT_PEM: ${{ secrets.PUBLIC_CERT_PEM }} | ||
PRIVATE_CERT_PEM: ${{ secrets.PRIVATE_CERT_PEM }} | ||
CCF_NAME: ${{ secrets.DEPLOYMENT_MCCF }} | ||
GH_TOKEN: ${{ github.token }} | ||
run: ./scripts/tools/install-deps.sh | ||
|
||
lint: | ||
runs-on: ubuntu-20.04 | ||
- name: Run Unit Tests | ||
run: npm run test | ||
|
||
e2e: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: KMS Lint | ||
run: make lint | ||
- name: Install Dependencies | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: ./scripts/tools/install-deps.sh | ||
|
||
- name: Build DevContainer | ||
uses: devcontainers/[email protected] | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
with: | ||
push: never | ||
configFile: .devcontainer/devcontainer.json | ||
runCmd: | | ||
scripts/set_python_env.sh && pip install -r requirements.txt | ||
make demo | ||
system: | ||
secrets: inherit # pragma: allowlist secret | ||
uses: ./.github/workflows/system-tests.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Endpoint Test | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
endpoint: | ||
type: string | ||
workflow_call: | ||
inputs: | ||
endpoint: | ||
type: string | ||
|
||
jobs: | ||
|
||
endpoint: | ||
name: ${{ inputs.endpoint }} (${{ matrix.env }}) | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
env: [local] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log into Azure | ||
uses: azure/login@v2 | ||
with: | ||
client-id: ${{ secrets.MANAGED_ID_CLIENT_ID }} | ||
tenant-id: ${{ secrets.MANAGED_ID_TENANT_ID }} | ||
subscription-id: ${{ vars.SUBSCRIPTION }} | ||
|
||
- name: Install Dependencies | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: ./scripts/tools/install-deps.sh | ||
|
||
- name: Run System Tests | ||
env: | ||
TEST_ENVIRONMENT: ${{ matrix.env }} | ||
run: | | ||
if [[ "$TEST_ENVIRONMENT" == "cloud" ]]; then | ||
pytest -sv -n auto test/system-test/test_${{ inputs.endpoint }}.py | ||
else | ||
pytest -sv test/system-test/test_${{ inputs.endpoint }}.py | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: System Tests | ||
|
||
permissions: | ||
id-token: write | ||
contents: read | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
jobs: | ||
discover-tests: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
endpoints: ${{ steps.find_tests.outputs.tests }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Find Test Files | ||
id: find_tests | ||
run: | | ||
TEST_FILES=$(cd test/system-test && find . -name 'test_*.py' | sed -e 's|^\./||' -e 's|^test_||' -e 's|\.py$||') | ||
JSON_ARRAY=$(printf '%s\n' "${TEST_FILES[@]}" | jq -R . | jq -s .) | ||
echo "tests=$JSON_ARRAY" | sed ':a;N;$!ba;s/\n//g' >> $GITHUB_OUTPUT | ||
endpoint: | ||
needs: discover-tests | ||
secrets: inherit # pragma: allowlist secret | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
endpoint: ${{ fromJson(needs.discover-tests.outputs.endpoints) }} | ||
uses: ./.github/workflows/endpoint-test.yml | ||
with: | ||
endpoint: ${{ matrix.endpoint }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.