Skip to content

Commit

Permalink
.github/workflows: add login-feature test (#118)
Browse files Browse the repository at this point in the history
* .github/workflows: add login-feature test

* chore: added `ATLAS_TOKEN` should fix the CI
  • Loading branch information
giautm authored Jan 24, 2024
1 parent 5ad3fd5 commit 4fb5cdc
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 4 deletions.
57 changes: 53 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@ jobs:
with:
terraform_version: ${{ matrix.terraform-version }}
terraform_wrapper: false
- name: Install Atlas-CLI
- name: Install Atlas CLI
run: |
curl -s -A "Terraform-Provider-CI" -o /usr/local/bin/atlas \
https://release.ariga.io/atlas/atlas-linux-amd64-latest?test=1
chmod +x /usr/local/bin/atlas
curl -sSf https://atlasgo.sh | sh
env:
ATLAS_DEBUG: "true"
ATLAS_FLAVOR: enterprise
- run: go test -v -cover ./...
env:
TF_ACC: '1'
Expand Down Expand Up @@ -298,3 +299,51 @@ jobs:
terraform init > /dev/null
terraform apply --auto-approve
terraform apply --auto-approve -var="schema=schema-2.hcl"
integration-sqlserver:
name: Integration SQL Server (Terraform ${{ matrix.terraform-version }})
runs-on: ubuntu-latest
needs: [build-dev]
services:
sqlserver:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: Y
MSSQL_PID: Developer
MSSQL_SA_PASSWORD: P@ssw0rd0995
ports:
- 1433:1433
sqlserver-dev:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: Y
MSSQL_PID: Developer
MSSQL_SA_PASSWORD: P@ssw0rd0995
ports:
- 1434:1433
strategy:
fail-fast: false
matrix:
terraform-version:
- '1.5.*'
- '1.6.*'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.21'
- uses: actions/download-artifact@v3
with:
name: atlas-provider
path: ./dist
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ matrix.terraform-version }}
terraform_wrapper: false
- name: Terraform (login-feature)
working-directory: integration-tests/login-feature
run: |
../../scripts/local.sh ../../dist 0.0.0-pre.0
terraform init > /dev/null
terraform apply --auto-approve
env:
ATLAS_TOKEN: ${{ secrets.ATLAS_TOKEN }}
24 changes: 24 additions & 0 deletions integration-tests/login-feature/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
terraform {
required_providers {
atlas = {
source = "ariga/atlas"
version = "0.0.0-pre.0"
}
}
}

variable "schema" {
type = string
default = "schema-1.hcl"
}

data "atlas_schema" "db" {
src = "file://${var.schema}"
dev_url = "sqlserver://sa:P@ssw0rd0995@localhost:1434?database=master"
}

resource "atlas_schema" "db" {
hcl = data.atlas_schema.db.hcl
url = "sqlserver://sa:P@ssw0rd0995@localhost:1433?database=master"
dev_url = "sqlserver://sa:P@ssw0rd0995@localhost:1434?database=master"
}
9 changes: 9 additions & 0 deletions integration-tests/login-feature/schema-1.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
schema "dbo" {}

table "users" {
schema = schema.dbo
column "id" {
null = false
type = nvarchar(50)
}
}

0 comments on commit 4fb5cdc

Please sign in to comment.