Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(endtoend): Pull region from environment #2750

Merged
merged 6 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ jobs:
with:
go-version: '1.21.1'

- run: curl -I https://debug.fly.dev
- name: set sqlc region
run: |
curl -I -s -o foo.txt -w 'FLY_REGION=%header{fly-region}' https://debug.fly.dev >> "$GITHUB_ENV"

- name: install gotestsum
run: go install gotest.tools/gotestsum@latest
Expand Down
5 changes: 4 additions & 1 deletion internal/endtoend/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ func TestValidSchema(t *testing.T) {

projectID := os.Getenv("CI_SQLC_PROJECT_ID")
authToken := os.Getenv("CI_SQLC_AUTH_TOKEN")

fmt.Println("region", os.Getenv("SQLC_REGION"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Remove once this is verified to work


if projectID == "" || authToken == "" {
if os.Getenv("CI") == "" {
t.Skip("skiping ddl tests outside of CI")
Expand Down Expand Up @@ -106,7 +109,7 @@ func TestValidSchema(t *testing.T) {

resp, err := client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{
Engine: "postgresql",
Region: "iad",
Region: os.Getenv("SQLC_REGION"),
Migrations: sqls,
})
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/sqltest/hosted/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ func PostgreSQL(t *testing.T, migrations []string) string {
seed = append(seed, string(blob))
}

fmt.Println("region", os.Getenv("SQLC_REGION"))
resp, err := client.CreateEphemeralDatabase(ctx, &pb.CreateEphemeralDatabaseRequest{
Engine: "postgresql",
Region: "iad",
Region: os.Getenv("SQLC_REGION"),
Migrations: seed,
})
if err != nil {
Expand Down
Loading