Skip to content

Commit

Permalink
First step to running integration tests against external databases (#468
Browse files Browse the repository at this point in the history
)

* Made the tests pick up environment variable GrateTestConfig__AdminConnectionString, and use that if available.
  - If no connectionstring is set, we use TestContainers
* Add terraform scripts that create a small environment in Azure to run tests against
  - Run Terraform to set up test environment before running tests, tear down environment after running tests.
  - Finished MariaDB, using Azure Container App for now
  - Planning on adding all databases, and variations of them (Azure AD login, having admin access, not having admin access, etc)
* Added separate integration tests GitHub actions pipeline to run the tests
  • Loading branch information
erikbra authored Mar 12, 2024
1 parent 5e695af commit 771dc9a
Show file tree
Hide file tree
Showing 166 changed files with 1,771 additions and 802 deletions.
68 changes: 0 additions & 68 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,72 +308,4 @@ jobs:
LogLevel: Warning
TZ: UTC

integration-test:
name: Tests cli
needs:
- set-version-number
- build-standalone

strategy:
# We could really like to:
# - Start each database (on another host, using Docker, or other means, e.g. Azure SQL, etc
# - On all architectures available (windows-latest, linux-latest, macos-latest, and macos-14),
# - Run command-line tests against each database.
#
# This way, we can test against all variations of each database too, e.g. Azure SQL, SQL Server "on prem" (in docker),
# hosted Oracle databases, aws databases, etc. But we need to find a way to provision these databases both very fast,
# and cheap, for each one.
matrix:
category:
- SqlServer
- PostgreSQL
- MariaDB
- Sqlite
- Oracle
os:
# We can only run tests on Linux for now, until we start the database separately somewhere (azure, something)
# and run against an external database. Because the commandline tests are also for now _dependent_ on
# TestContainers, and running the database in a container using Docker. And Docker is only available on Linux
# on Github actions.
# - name: windows-latest
# arch: win-x64
# executable: grate.exe
- name: ubuntu-latest
arch: linux-x64
executable: grate
# - name: macos-latest
# arch: osx-x64
# executable: grate
# macos-14 is M1 (arm64)
# - name: macos-14
# arch: osx-x64
# executable: grate

runs-on: ${{ matrix.os.name }}
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: grate-${{ matrix.os.arch }}-self-contained-${{ needs.set-version-number.outputs.nuGetVersion }}
path: executables/${{ matrix.os.arch }}
- name: Setup .NET 8
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: chmod u+x
run: chmod u+x $GrateExecutablePath
if: ${{ matrix.os.arch != 'win-x64' }}
env:
GrateExecutablePath: ${{ github.workspace }}/executables/${{ matrix.os.arch }}/${{ matrix.os.executable }}
- name: Test
run: >
dotnet test
unittests/CommandLine/CommandLine.${{ matrix.category }}
--logger:"xunit;LogFilePath=/tmp/test-results/${{ matrix.os.arch }}/CommandLine.${{ matrix.category }}.xml" --
-MaxCpuCount 2
env:
LogLevel: Warning
GrateExecutablePath: ${{ github.workspace }}/executables/${{ matrix.os.arch }}/${{ matrix.os.executable }}
TZ: UTC

Loading

0 comments on commit 771dc9a

Please sign in to comment.