Skip to content

Commit

Permalink
Enable BigQuery connection test (closes #11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy-Hay committed Mar 27, 2024
1 parent f43df7d commit e7a6890
Show file tree
Hide file tree
Showing 8 changed files with 542 additions and 25 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- uses: TimonVS/pr-labeler-action@v3.1.0
- uses: TimonVS/pr-labeler-action@v4.0.0
if: github.event_name == 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/install-nix-action@v17
- uses: cachix/cachix-action@v10
- uses: cachix/install-nix-action@v20
- uses: cachix/cachix-action@v13
with:
name: cachix-action
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
Expand All @@ -29,6 +29,6 @@ jobs:
- name: Build
run: nix develop -c go build
- name: Push changes
uses: stefanzweifel/git-auto-commit-action@v4.14.1
uses: stefanzweifel/git-auto-commit-action@v4.15.1
with:
commit_message: Run formatter/linter
2 changes: 1 addition & 1 deletion .github/workflows/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
pr-labeler:
runs-on: ubuntu-latest
steps:
- uses: TimonVS/pr-labeler-action@v3
- uses: TimonVS/pr-labeler-action@v5.0.0
with:
configuration-path: .github/workflows/config/pr-labeler.yml
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v17
- uses: cachix/cachix-action@v10
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v20
- uses: cachix/cachix-action@v13
with:
name: cachix-action
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/snyk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/golang@master
Expand Down
24 changes: 20 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,47 @@ Conntest is a command-line utility for validating connections to Snowplow-suppor
## Running

To check your database connection, run:

```shell
conntest check --dsn your://database/uri --retry-times 0 --tags 'aTag=value;anotherTag=value'
```

### Example

For Snowflake:-

```shell
$ conntest check --tags aTag=value --dsn snowflake://lorem:[email protected]/lorem?account=ab01234&ocspFailOpen=true&protocol=https&region=eu-central-1&role=SNOWPLOW_LOADER_ROLE&schema=SNOWPLOW&validateDefaultParameters=true&warehouse=COMPUTE_WH

{"id":"b732dd11-428d-4063-aa35-118e0e8ab51f","name":"fabric:warehouse-connection-check","version":1,"emittedBy":"conntest","timestamp":"2022-10-10T08:36:27.832840488Z","data":{"host":"abcdefg-ab01234.snowflakecomputing.com","complete":false,"messages":["HTTP Response code: 500"],"tags":{"aTag":"value"},"attempts":1}}
```

For BigQuery:-

```shell
conntest check --dsn bigquery://:@engineering-sandbox/testantonis --retry-times 0 --tags 'aTag=value;anotherTag=value'

{"id":"1a71a92e-60b0-4061-b32b-47588faae105","name":"fabric:warehouse-connection-check","version":1,"emittedBy":"conntest","timestamp":"2024-03-27T19:11:40.703468Z","data":{"host":"engineering-sandbox","complete":true,"messages":[],"tags":{"aTag":"value","anotherTag":"value"},"attempts":0}}
```

## Development

This repo uses nix to provide [reproducible development environment](https://nixos.org/guides/ad-hoc-developer-environments.html). To make use of the provided setup:

1. Install `nix`:

```shell
sh <(curl -L https://nixos.org/nix/install)
```

2. Enable experimental flags
``` shell

```shell
mkdir -p ~/.config/nix && echo 'experimental-features = nix-command flakes' > ~/.config/nix/nix.conf
```

3. Enter development environment

```shell
nix develop
```
Expand All @@ -42,7 +58,8 @@ nix develop
> If you want the convenience of getting the development environment upon `cd` into directory use [direnv](https://direnv.net)
4. Develop
```

```shell
# format
go fmt ./...
# build
Expand All @@ -53,10 +70,9 @@ go test -v ./... -test.short
go test -v ./...
```


### Copyright and license

Conntest is copyright 2022-2022 Snowplow Analytics Ltd.
Conntest is copyright 2022-2024 Snowplow Analytics Ltd.

Licensed under the **[Apache License, Version 2.0][license]** (the "License");
you may not use this software except in compliance with the License.
Expand Down
33 changes: 22 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ require (
)

require (
cloud.google.com/go v0.104.0 // indirect
cloud.google.com/go/bigquery v1.42.0 // indirect
cloud.google.com/go/compute v1.10.0 // indirect
cloud.google.com/go/iam v0.5.0 // indirect
github.com/Azure/azure-pipeline-go v0.2.3 // indirect
github.com/Azure/azure-storage-blob-go v0.14.0 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
Expand Down Expand Up @@ -43,9 +47,12 @@ require (
github.com/form3tech-oss/jwt-go v3.2.5+incompatible // indirect
github.com/gabriel-vasile/mimetype v1.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/flatbuffers v2.0.0+incompatible // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/klauspost/compress v1.13.6 // indirect
Expand All @@ -61,17 +68,21 @@ require (
github.com/pierrec/lz4/v4 v4.1.11 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/testcontainers/testcontainers-go v0.13.0 // indirect
go.opencensus.io v0.22.3 // indirect
go.opencensus.io v0.23.0 // indirect
golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect
golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4 // indirect
golang.org/x/sys v0.0.0-20211124211545-fe61309f8881 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20210630183607-d20f26d13c79 // indirect
google.golang.org/grpc v1.39.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect
golang.org/x/sys v0.0.0-20221013171732-95e765b1cc43 // indirect
golang.org/x/text v0.3.8 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/api v0.99.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a // indirect
google.golang.org/grpc v1.50.1 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/bigquery v1.2.0 // indirect
)
Loading

0 comments on commit e7a6890

Please sign in to comment.