Add workflow for running Docker-only acc tests (#18672)

* Add workflow for running Docker-only acc tests

* Convert to caller/called workflow

* Add comments for posterity and change run trigger

* Standardize workflow names and adjust artifact retention time

* Consolidate metadata job into test job

* Shorten artifact retention time

* Standardize filenames

* Correct workflow reference

* Remove erroneous dependency reference
This commit is contained in:
Michael Anthony
2023-01-20 12:57:56 -07:00
committed by GitHub
parent 3b729a0ca9
commit dd8f055cc7
2 changed files with 66 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
name: test-go-acceptance-nightly
on:
# Change to nightly cadence once API-credential-requiring tests are added to the jobs
workflow_dispatch:
env:
VAULT_ACC: 1
# Currently the jobs here are only for acceptance tests that have no dependencies except for Docker
jobs:
plugins-database:
uses: ./.github/workflows/test-run-go-tests-for-path.yml
strategy:
matrix:
name: [mongodb, mysql, postgresql]
with:
name: plugins-database-${{ matrix.name }}
path: plugins/database/${{ matrix.name }}
external:
uses: ./.github/workflows/test-run-go-tests-for-path.yml
strategy:
matrix:
name: [api, identity, token]
with:
name: external-${{ matrix.name }}
path: vault/external_tests/${{ matrix.name }}
# Suggestions and tips for adding more acceptance test jobs:
# - the job name is up to you, but it should be derived from the path that the tests are found in
# - for instance, "plugins-database" is a job for acceptance tests in the plugins/database path
# - the path will be used with go test wildcards, but don't include the preceding "./" or following "/..."
# - the name parameter is used to construct the log artifact's name, make it something that is related to the path

View File

@@ -0,0 +1,32 @@
name: test-run-go-tests-for-path
on:
workflow_call:
inputs:
name:
description: 'The name to use that will appear in the output log file artifact'
required: true
type: string
path:
description: 'The path to the test without the precedeing "./" or following "/..." e.g. go test -v ./$path/...'
required: true
type: string
# We will need to add the capacity for receiving passed secrets once we get to the tests that require API credentials
jobs:
go-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: get-metadata
run: echo "go-version=$(cat ./.go-version)" >> $GITHUB_OUTPUT
- name: Set Up Go
uses: actions/setup-go@v3
with:
go-version: ${{ steps.get-metadata.outputs.go-version }}
- run: go test -v ./${{ inputs.path }}/... 2>&1 | tee ${{ inputs.name }}.txt
- uses: actions/upload-artifact@v3
with:
name: ${{ inputs.name }}-output
path: ${{ inputs.name }}.txt
retention-days: 2