From 013a9351eb9edd07f71e86851db92e0bf03c5ed5 Mon Sep 17 00:00:00 2001 From: Arun Sori Date: Fri, 28 Apr 2023 12:03:14 +0000 Subject: [PATCH 01/11] Add support for created schema state across replicated cluster in ClickHouse --- .gitlab-ci.yml | 92 ++++++++++++ Makefile | 7 + dialect.go | 7 + go.mod | 19 ++- go.sum | 127 ++++++++++++++++ internal/cfg/cfg.go | 22 ++- internal/cfg/cfg_test.go | 39 +++++ internal/dialect/dialectquery/clickhouse.go | 54 ++++++- .../dialectquery/clickhouse_dialect_test.go | 142 ++++++++++++++++++ internal/dialect/dialectquery/dialectquery.go | 6 + internal/dialect/store.go | 11 ++ internal/testdb/clickhouse.go | 57 ++++++- tests/clickhouse/clickhouse-replicated.xml | 47 ++++++ tests/clickhouse/clickhouse_test.go | 72 +++++++++ 14 files changed, 698 insertions(+), 4 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 internal/cfg/cfg_test.go create mode 100644 internal/dialect/dialectquery/clickhouse_dialect_test.go create mode 100644 tests/clickhouse/clickhouse-replicated.xml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..e23c2df70 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,92 @@ +stages: + - build + - test + - images + +variables: + GO_IMAGE: golang:1.20 + DOCKER_VERSION: "20.10.21" + DOCKER_IMAGE_REGISTRY: registry.gitlab.com/gitlab-org/opstrace/goose + ## runner feature flag to try and speed up cache zipping - https://docs.gitlab.com/runner/configuration/feature-flags.html + FF_USE_FASTZIP: "true" + # compression levels set to fast (larger cache files) + ARTIFACT_COMPRESSION_LEVEL: "fast" + CACHE_COMPRESSION_LEVEL: "fast" + +default: + image: $GO_IMAGE + +.go-cache: + variables: + GOPATH: $CI_PROJECT_DIR/.go + cache: + key: + files: + - go.sum + paths: + - .go/pkg/mod/ + +#lint: +# stage: test +# extends: .go-cache +# script: +# - make lint + +build: + stage: build + extends: .go-cache + script: + - make build + +test: + stage: test + extends: .go-cache + script: + - make test-packages + +#images: +# stage: images +# extends: +# - .docker +# script: +# - make docker docker-push +# variables: +# DOCKER_REPO: $DOCKER_IMAGE_REGISTRY +# DOCKER_TAG: $CI_COMMIT_SHORT_SHA +# needs: [test] +# cache: [] + +e2e-test: + stage: test + image: $GO_IMAGE + variables: + DOCKER_DRIVER: overlay2 + DOCKER_HOST: tcp://docker:2375 + DOCKER_TLS_CERTDIR: "" + DB_HOST: "docker" + services: + - name: docker:${DOCKER_VERSION}-dind + # explicitly disable tls to avoid docker startup interruption + command: ["--tls=false"] + tags: + - gitlab-org-docker + extends: + - .go-cache + script: + - make test-e2e-clickhouse + +.docker: + image: docker:${DOCKER_VERSION}-git + services: + - name: docker:${DOCKER_VERSION}-dind + # explicitly disable tls to avoid docker startup interruption + command: ["--tls=false"] + variables: + DOCKER_DRIVER: overlay2 + DOCKER_HOST: tcp://docker:2375 + DOCKER_TLS_CERTDIR: "" + tags: + - gitlab-org-docker + before_script: + - apk add --no-cache make bash + - echo "${CI_REGISTRY_PASSWORD}" | docker login --username "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}" \ No newline at end of file diff --git a/Makefile b/Makefile index a41d259a0..06b8296e2 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ GO_TEST_FLAGS ?= -race -count=1 -v -timeout=10m +GOOS ?= $(shell go env GOOS) +GOARCH ?= $(shell go env GOARCH) .PHONY: dist dist: @@ -10,6 +12,11 @@ dist: GOOS=windows GOARCH=amd64 go build -o ./bin/goose-windows64.exe ./cmd/goose GOOS=windows GOARCH=386 go build -o ./bin/goose-windows386.exe ./cmd/goose +build: + @mkdir -p ./bin + @rm -f ./bin/* + go build -o ./bin/goose-$(GOOS)-$(GOARCH) ./cmd/goose + .PHONY: clean clean: @find . -type f -name '*.FAIL' -delete diff --git a/dialect.go b/dialect.go index 67275b4f6..385b562d2 100644 --- a/dialect.go +++ b/dialect.go @@ -39,3 +39,10 @@ func SetDialect(s string) error { store, err = dialect.NewStore(d, TableName()) return err } + +func AttachOptions(options map[string]string) error { + if storeWithOptions, ok := store.(dialect.StoreOptions); ok { + return storeWithOptions.AttachOptions(options) + } + return nil +} diff --git a/go.mod b/go.mod index d125fd5a2..862702b6e 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,16 @@ module github.com/pressly/goose/v3 -go 1.18 +go 1.20 require ( github.com/ClickHouse/clickhouse-go/v2 v2.9.0 github.com/go-sql-driver/mysql v1.7.0 + github.com/google/go-cmp v0.5.9 github.com/jackc/pgx/v5 v5.3.1 github.com/microsoft/go-mssqldb v0.21.0 github.com/ory/dockertest/v3 v3.10.0 + github.com/stretchr/testify v1.8.2 + github.com/testcontainers/testcontainers-go v0.19.0 github.com/vertica/vertica-sql-go v1.3.2 github.com/ziutek/mymysql v1.5.4 modernc.org/sqlite v1.21.1 @@ -20,8 +23,12 @@ require ( github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect github.com/andybalholm/brotli v1.0.5 // indirect github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/containerd/containerd v1.6.19 // indirect github.com/containerd/continuity v0.3.0 // indirect + github.com/cpuguy83/dockercfg v0.3.1 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v23.0.3+incompatible // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect github.com/docker/docker v23.0.3+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect @@ -33,6 +40,7 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect + github.com/golang/protobuf v1.5.2 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.3.0 // indirect github.com/imdario/mergo v0.3.15 // indirect @@ -42,15 +50,20 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/compress v1.16.4 // indirect github.com/lib/pq v1.10.7 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-isatty v0.0.18 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/moby/patternmatcher v0.5.0 // indirect + github.com/moby/sys/sequential v0.5.0 // indirect github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect + github.com/morikuni/aec v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/opencontainers/runc v1.1.6 // indirect github.com/paulmach/orb v0.9.0 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect @@ -64,9 +77,13 @@ require ( go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/crypto v0.8.0 // indirect golang.org/x/mod v0.10.0 // indirect + golang.org/x/net v0.9.0 // indirect golang.org/x/sys v0.7.0 // indirect golang.org/x/text v0.9.0 // indirect golang.org/x/tools v0.8.0 // indirect + google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad // indirect + google.golang.org/grpc v1.47.0 // indirect + google.golang.org/protobuf v1.28.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect howett.net/plist v1.0.0 // indirect diff --git a/go.sum b/go.sum index c9680a32b..a03056045 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,5 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.2/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1/go.mod h1:gLa1CL2RNE4s7M3yopJ/p0iq5DdY6Yv5ZUt9MTRZOQM= @@ -5,20 +7,36 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLC github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1/go.mod h1:4qFor3D/HDsvBME35Xy9rwW9DecL+M2sNw1ybjPtwA0= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ClickHouse/ch-go v0.54.0 h1:WzPo/iZ8Gchb9Ze30TywMheOzKW5FkhTeZPxvz/iE6o= github.com/ClickHouse/ch-go v0.54.0/go.mod h1:2jvyjBRb5zhzFvcOBxPelzpbB9qsS47vwJssurJe2OA= github.com/ClickHouse/clickhouse-go/v2 v2.9.0 h1:vh0D+9p5hKWLYqCfU8Hd7/GMXNfHC84isUf7sNlJrZk= github.com/ClickHouse/clickhouse-go/v2 v2.9.0/go.mod h1:teXfZNM90iQ99Jnuht+dxQXCuhDZ8nvvMoTJOFrcmcg= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/Microsoft/hcsshim v0.9.7 h1:mKNHW/Xvv1aFH87Jb6ERDzXTJTLPlmzfZ28VBFD/bfg= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/containerd/containerd v1.6.19 h1:F0qgQPrG0P2JPgwpxWxYavrVeXAG0ezUIB9Z/4FTUAU= +github.com/containerd/containerd v1.6.19/go.mod h1:HZCDMn4v/Xl2579/MvtOC2M206i+JJ6VxFWU/NetrGY= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= +github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -28,6 +46,7 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/cli v23.0.3+incompatible h1:Zcse1DuDqBdgI7OQDV8Go7b83xLgfhW1eza4HfEdxpY= github.com/docker/cli v23.0.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v23.0.3+incompatible h1:9GhVsShNWz1hO//9BNg/dpMnZW25KydO4wtVxWAIbho= github.com/docker/docker v23.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= @@ -42,6 +61,13 @@ github.com/elastic/go-sysinfo v1.10.1/go.mod h1:QElTrQ6akcnAVCRwdkZtoAkwuTv8UVM4 github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0= github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw= github.com/go-faster/errors v0.6.1 h1:nNIPOBkprlKzkThvS/0YaX8Zs9KewLCOSFQS5BU06FI= @@ -56,19 +82,43 @@ github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0kt github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= @@ -102,6 +152,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= @@ -109,11 +161,17 @@ github.com/microsoft/go-mssqldb v0.21.0 h1:p2rpHIL7TlSv1QrbXJUAcbyRKnIT0C9rRkH2E github.com/microsoft/go-mssqldb v0.21.0/go.mod h1:+4wZTUnz/SV6nffv+RRRB/ss8jPng5Sho2SmM1l2ts4= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= +github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= +github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= @@ -134,12 +192,14 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= @@ -149,11 +209,19 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/testcontainers/testcontainers-go v0.19.0 h1:3bmFPuQRgVIQwxZJERyzB8AogmJW3Qzh8iDyfJbPhi8= +github.com/testcontainers/testcontainers-go v0.19.0/go.mod h1:3YsSoxK0rGEUzbGD4gUVt1Nm3GJpCIq94GX+2LSf3d4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/vertica/vertica-sql-go v1.3.2 h1:QclPnkuozQyNl6lbrTdeuFSx2/lcSRZc1XL8zWNSjdA= github.com/vertica/vertica-sql-go v1.3.2/go.mod h1:jnn2GFuv+O2Jcjktb7zyc4Utlbu9YVqpHH/lx63+1M4= @@ -177,6 +245,7 @@ go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -185,32 +254,53 @@ golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -225,11 +315,17 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -239,8 +335,36 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad h1:kqrS+lhvaMHCxul6sKQvKJ8nAAhlVItmZV822hYFH/U= +google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= +google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -249,6 +373,7 @@ gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHN gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -257,6 +382,8 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= diff --git a/internal/cfg/cfg.go b/internal/cfg/cfg.go index aa9707633..b6cd3af37 100644 --- a/internal/cfg/cfg.go +++ b/internal/cfg/cfg.go @@ -1,6 +1,9 @@ package cfg -import "os" +import ( + "os" + "strings" +) var ( GOOSEDRIVER = envOr("GOOSE_DRIVER", "") @@ -8,6 +11,8 @@ var ( GOOSEMIGRATIONDIR = envOr("GOOSE_MIGRATION_DIR", DefaultMigrationDir) // https://no-color.org/ GOOSENOCOLOR = envOr("NO_COLOR", "false") + + GOOSE_CLICKHOUSE_PARAMS = envOr("GOOSE_CLICKHOUSE_PARAMS", "") ) var ( @@ -26,6 +31,7 @@ func List() []EnvVar { {Name: "GOOSE_DBSTRING", Value: GOOSEDBSTRING}, {Name: "GOOSE_MIGRATION_DIR", Value: GOOSEMIGRATIONDIR}, {Name: "NO_COLOR", Value: GOOSENOCOLOR}, + {Name: "GOOSE_CLICKHOUSE_PARAMS", Value: GOOSE_CLICKHOUSE_PARAMS}, } } @@ -37,3 +43,17 @@ func envOr(key, def string) string { } return val } + +func SplitKeyValuesIntoMap(input string) map[string]string { + cutset := strings.Split(input, ",") + + options := make(map[string]string) + for _, item := range cutset { + keyAndValues := strings.Split(item, "=") + if len(keyAndValues) != 2 { + continue + } + options[keyAndValues[0]] = keyAndValues[1] + } + return options +} diff --git a/internal/cfg/cfg_test.go b/internal/cfg/cfg_test.go new file mode 100644 index 000000000..88080963e --- /dev/null +++ b/internal/cfg/cfg_test.go @@ -0,0 +1,39 @@ +package cfg + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestSplitKeyValuesIntoMap(t *testing.T) { + t.Parallel() + + type testData struct { + input string + result map[string]string + } + + tests := []testData{ + { + input: "some_key=value", + result: map[string]string{ + "some_key": "value", + }, + }, + { + input: "key1=value1,key2=value2", + result: map[string]string{ + "key1": "value1", + "key2": "value2", + }, + }, + } + + for _, test := range tests { + out := SplitKeyValuesIntoMap(test.input) + if diff := cmp.Diff(test.result, out); diff != "" { + t.Errorf("SplitKeyValuesIntoMap() mismatch (-want +got):\n%s", diff) + } + } +} diff --git a/internal/dialect/dialectquery/clickhouse.go b/internal/dialect/dialectquery/clickhouse.go index 6f1040afa..ea8cb9fb7 100644 --- a/internal/dialect/dialectquery/clickhouse.go +++ b/internal/dialect/dialectquery/clickhouse.go @@ -2,8 +2,23 @@ package dialectquery import "fmt" +const ( + paramOnCluster = "ON_CLUSTER" + paramZooPath = "ZOO_PATH" + paramClusterMacro = "CLUSTER_MACRO" + paramReplicaMacro = "REPLICA_MACRO" +) + +type clusterParameters struct { + OnCluster bool + ZooPath string + ClusterMacro string + ReplicaMacro string +} + type Clickhouse struct { - Table string + Table string + Params clusterParameters } var _ Querier = (*Clickhouse)(nil) @@ -17,6 +32,19 @@ func (c *Clickhouse) CreateTable() string { ) ENGINE = MergeTree() ORDER BY (date)` + + qCluster := `CREATE TABLE IF NOT EXISTS %s ON CLUSTER '%s' ( + version_id Int64, + is_applied UInt8, + date Date default now(), + tstamp DateTime('UTC') default now() + ) + ENGINE = ReplicatedMergeTree('%s', '%s') + ORDER BY (date)` + + if c.Params.OnCluster { + return fmt.Sprintf(qCluster, c.Table, c.Params.ClusterMacro, c.Params.ZooPath, c.Params.ReplicaMacro) + } return fmt.Sprintf(q, c.Table) } @@ -39,3 +67,27 @@ func (c *Clickhouse) ListMigrations() string { q := `SELECT version_id, is_applied FROM %s ORDER BY version_id DESC` return fmt.Sprintf(q, c.Table) } + +func (c *Clickhouse) AttachOptions(options map[string]string) error { + if val, ok := options[paramOnCluster]; ok { + if val == "true" { + clusterMacro, ok := options[paramClusterMacro] + if !ok { + clusterMacro = "{cluster}" + } + zooPath, ok := options[paramZooPath] + if !ok { + zooPath = fmt.Sprintf("/clickhouse/tables/%s/{table}", clusterMacro) + } + replicaMacro, ok := options[paramReplicaMacro] + if !ok { + replicaMacro = "{replica}" + } + c.Params.ZooPath = zooPath + c.Params.ClusterMacro = clusterMacro + c.Params.ReplicaMacro = replicaMacro + c.Params.OnCluster = true + } + } + return nil +} diff --git a/internal/dialect/dialectquery/clickhouse_dialect_test.go b/internal/dialect/dialectquery/clickhouse_dialect_test.go new file mode 100644 index 000000000..0a324da4d --- /dev/null +++ b/internal/dialect/dialectquery/clickhouse_dialect_test.go @@ -0,0 +1,142 @@ +package dialectquery + +import ( + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestClickhouseCreateTable(t *testing.T) { + t.Parallel() + + type testData struct { + clickhouse *Clickhouse + result string + } + + tests := []testData{ + { + clickhouse: &Clickhouse{ + Table: "schema_migrations", + Params: clusterParameters{ + OnCluster: true, + ZooPath: "/clickhouse/tables/{cluster}/{table}", + ClusterMacro: "{cluster}", + ReplicaMacro: "{replica}", + }, + }, + result: `CREATE TABLE IF NOT EXISTS schema_migrations ON CLUSTER '{cluster}' ( + version_id Int64, + is_applied UInt8, + date Date default now(), + tstamp DateTime('UTC') default now() + ) + ENGINE = ReplicatedMergeTree('/clickhouse/tables/{cluster}/{table}', '{replica}') + ORDER BY (date)`, + }, + { + clickhouse: &Clickhouse{ + Table: "schema_migrations_v1", + Params: clusterParameters{ + OnCluster: true, + ZooPath: "/clickhouse/tables/dev-cluster/{table}", + ClusterMacro: "dev-cluster", + ReplicaMacro: "{replica}", + }, + }, + result: `CREATE TABLE IF NOT EXISTS schema_migrations_v1 ON CLUSTER 'dev-cluster' ( + version_id Int64, + is_applied UInt8, + date Date default now(), + tstamp DateTime('UTC') default now() + ) + ENGINE = ReplicatedMergeTree('/clickhouse/tables/dev-cluster/{table}', '{replica}') + ORDER BY (date)`, + }, + } + + for _, test := range tests { + out := test.clickhouse.CreateTable() + if diff := cmp.Diff(test.result, out); diff != "" { + t.Errorf("clickhouse.CreateTable() mismatch (-want +got):\n%s", diff) + } + } +} + +func TestClickhouseAttachOptions(t *testing.T) { + t.Parallel() + + type testData struct { + options map[string]string + input *Clickhouse + err error + expected clusterParameters + } + + tests := []testData{ + { + options: map[string]string{ + "ON_CLUSTER": "true", + }, + input: &Clickhouse{}, + err: nil, + expected: clusterParameters{ + OnCluster: true, + ZooPath: "/clickhouse/tables/{cluster}/{table}", + ClusterMacro: "{cluster}", + ReplicaMacro: "{replica}", + }, + }, + { + options: map[string]string{ + "ON_CLUSTER": "true", + "ZOO_PATH": "/clickhouse/hard_coded_path", + }, + input: &Clickhouse{}, + err: nil, + expected: clusterParameters{ + OnCluster: true, + ZooPath: "/clickhouse/hard_coded_path", + ClusterMacro: "{cluster}", + ReplicaMacro: "{replica}", + }, + }, + { + options: map[string]string{ + "ON_CLUSTER": "true", + "ZOO_PATH": "/clickhouse/hard_coded_path", + "CLUSTER_MACRO": "dev-cluster", + "REPLICA_MACRO": "replica-01", + }, + input: &Clickhouse{}, + err: nil, + expected: clusterParameters{ + OnCluster: true, + ZooPath: "/clickhouse/hard_coded_path", + ClusterMacro: "dev-cluster", + ReplicaMacro: "replica-01", + }, + }, + { + options: map[string]string{ + "ON_CLUSTER": "false", + }, + input: &Clickhouse{}, + err: nil, + expected: clusterParameters{ + OnCluster: false, + }, + }, + } + + for _, test := range tests { + err := test.input.AttachOptions(test.options) + if err != test.err { + t.Errorf("AttachOptions mismatch expected error: %v, got: %v", test.err, err) + } + if diff := cmp.Diff(test.expected, test.input.Params); diff != "" { + t.Errorf("clickhouse.AttachOptions() mismatch (-want +got):\n%s", diff) + } + } + +} diff --git a/internal/dialect/dialectquery/dialectquery.go b/internal/dialect/dialectquery/dialectquery.go index a8951a736..06432b4f6 100644 --- a/internal/dialect/dialectquery/dialectquery.go +++ b/internal/dialect/dialectquery/dialectquery.go @@ -26,3 +26,9 @@ type Querier interface { // The query should return the version_id and is_applied columns. ListMigrations() string } + +// QuerierOptions is an interface to provide specific options to a dialect. +// For ex: providing replication support to underlying migration table. +type QuerierOptions interface { + AttachOptions(map[string]string) error +} diff --git a/internal/dialect/store.go b/internal/dialect/store.go index e16e0356a..4cb4e20c2 100644 --- a/internal/dialect/store.go +++ b/internal/dialect/store.go @@ -46,6 +46,10 @@ type Store interface { ListMigrations(ctx context.Context, db *sql.DB) ([]*ListMigrationsResult, error) } +type StoreOptions interface { + AttachOptions(map[string]string) error +} + // NewStore returns a new Store for the given dialect. // // The table name is used to store the goose migrations. @@ -162,3 +166,10 @@ func (s *store) ListMigrations(ctx context.Context, db *sql.DB) ([]*ListMigratio } return migrations, nil } + +func (s *store) AttachOptions(options map[string]string) error { + if querierWithOptions, ok := s.querier.(dialectquery.QuerierOptions); ok { + return querierWithOptions.AttachOptions(options) + } + return nil +} diff --git a/internal/testdb/clickhouse.go b/internal/testdb/clickhouse.go index f0ee13a12..fa8de4a98 100644 --- a/internal/testdb/clickhouse.go +++ b/internal/testdb/clickhouse.go @@ -1,16 +1,20 @@ package testdb import ( + "context" "crypto/tls" "database/sql" "fmt" "log" + "os" "strconv" "time" "github.com/ClickHouse/clickhouse-go/v2" "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" + "github.com/testcontainers/testcontainers-go" + "github.com/testcontainers/testcontainers-go/wait" ) const ( @@ -24,6 +28,12 @@ const ( CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT = "1" ) +var ( + // DB_HOST is the hostname where ClickHouse is running + // localhost for local runs and docker for CI runs + DB_HOST string +) + func newClickHouse(opts ...OptionsFunc) (*sql.DB, func(), error) { option := &options{} for _, f := range opts { @@ -74,8 +84,12 @@ func newClickHouse(opts ...OptionsFunc) (*sql.DB, func(), error) { log.Printf("failed to purge resource: %v", err) } } + host := os.Getenv("DB_HOST") + if host == "" { + host = "localhost" + } // Fetch port assigned to container - address := fmt.Sprintf("%s:%s", "localhost", container.GetPort("9000/tcp")) + address := fmt.Sprintf("%s:%s", host, container.GetPort("9000/tcp")) var db *sql.DB // Exponential backoff-retry, because the application in the container @@ -112,3 +126,44 @@ func clickHouseOpenDB(address string, tlsConfig *tls.Config, debug bool) *sql.DB db.SetConnMaxLifetime(time.Hour) return db } + +const ( + ClickHousePort = "9000/tcp" + ClickhouseHTTPPort = "8123/tcp" + clickHouseImage = "clickhouse/clickhouse-server:23.2.6.34-alpine" +) + +func CreateClickHouseContainer(ctx context.Context, configPath string) (testcontainers.Container, error) { + var mounts testcontainers.ContainerMounts + if configPath != "" { + mounts = testcontainers.Mounts(testcontainers.BindMount(configPath, "/etc/clickhouse-server/config.d/testconf.xml")) + } + chReq := testcontainers.ContainerRequest{ + Image: clickHouseImage, + ExposedPorts: []string{ClickHousePort, ClickhouseHTTPPort}, + WaitingFor: wait.ForHTTP("/").WithPort(ClickhouseHTTPPort), + Mounts: mounts, + } + return testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ + ContainerRequest: chReq, + Started: true, + }) +} + +func OpenClickhouse(endpoint string, debug bool) (*sql.DB, error) { + opts, err := clickhouse.ParseDSN(endpoint) + if err != nil { + return nil, nil + } + + opts.Debug = debug + + opts.Settings = clickhouse.Settings{ + "max_execution_time": 60, + } + opts.DialTimeout = 5 * time.Second + opts.Compression = &clickhouse.Compression{ + Method: clickhouse.CompressionLZ4, + } + return clickhouse.OpenDB(opts), nil +} diff --git a/tests/clickhouse/clickhouse-replicated.xml b/tests/clickhouse/clickhouse-replicated.xml new file mode 100644 index 000000000..7352ac53a --- /dev/null +++ b/tests/clickhouse/clickhouse-replicated.xml @@ -0,0 +1,47 @@ + + + + cluster + 0 + cluster + 0 + cluster-0-0 + + + + + + true + + localhost + 9000 + + + + + + + 2181 + 0 + /var/log/clickhouse-server/coordination/log + /var/lib/clickhouse/coordination/snapshots + + + 0 + localhost + 9444 + + + + + + + + localhost + 2181 + + + + /clickhouse/cluster/task_queue/ddl + + \ No newline at end of file diff --git a/tests/clickhouse/clickhouse_test.go b/tests/clickhouse/clickhouse_test.go index 2ccfbe947..32f129a2a 100644 --- a/tests/clickhouse/clickhouse_test.go +++ b/tests/clickhouse/clickhouse_test.go @@ -1,8 +1,11 @@ package clickhouse_test import ( + "context" + "fmt" "log" "os" + "path" "path/filepath" "testing" "time" @@ -10,6 +13,7 @@ import ( "github.com/pressly/goose/v3" "github.com/pressly/goose/v3/internal/check" "github.com/pressly/goose/v3/internal/testdb" + "github.com/stretchr/testify/require" ) func TestMain(m *testing.M) { @@ -126,6 +130,74 @@ func TestClickHouseFirstThree(t *testing.T) { } } +func TestClickHouseOnCluster(t *testing.T) { + err := goose.AttachOptions(map[string]string{ + "ON_CLUSTER": "true", + }) + require.NoError(t, err) + ctx := context.Background() + + workingDir, err := os.Getwd() + require.NoError(t, err) + + // Minimal additional configuration (config.d) to enable cluster mode + replconf := path.Join(workingDir, "clickhouse-replicated.xml") + chContainer, err := testdb.CreateClickHouseContainer(ctx, replconf) + require.NoError(t, err) + + t.Cleanup(func() { + if err := chContainer.Terminate(ctx); err != nil { + t.Fatalf("failed to terminate container: %s", err) + } + // Reset the DB to default state - for some reason clearing up just the options doesn't work + if err := goose.SetDialect("clickhouse"); err != nil { + t.Fatalf("failed to set dialect: %s", err) + } + err := goose.AttachOptions(map[string]string{ + "ON_CLUSTER": "", + }) + if err != nil { + t.Fatalf("failed to clean up dialet: %s", err) + } + }) + + port, err := chContainer.MappedPort(ctx, "9000/tcp") + require.NoError(t, err) + host, err := chContainer.Host(ctx) + require.NoError(t, err) + endpoint := fmt.Sprintf("clickhouse://%s:%s", host, port.Port()) + t.Log(endpoint) + + db, err := testdb.OpenClickhouse(endpoint, true) + require.NoError(t, err) + + _, err = goose.GetDBVersion(db) + require.NoError(t, err) + + migrationDir := filepath.Join("testdata", "migrations") + // Collect migrations so we don't have to hard-code the currentVersion + // in an assertion later in the test. + migrations, err := goose.CollectMigrations(migrationDir, 0, goose.MaxVersion) + check.NoError(t, err) + + currentVersion, err := goose.GetDBVersion(db) + check.NoError(t, err) + check.Number(t, currentVersion, 0) + + err = goose.Up(db, migrationDir) + check.NoError(t, err) + currentVersion, err = goose.GetDBVersion(db) + check.NoError(t, err) + check.Number(t, currentVersion, len(migrations)) + + err = goose.DownTo(db, migrationDir, 0) + check.NoError(t, err) + + currentVersion, err = goose.GetDBVersion(db) + check.NoError(t, err) + check.Number(t, currentVersion, 0) +} + func TestRemoteImportMigration(t *testing.T) { t.Parallel() // TODO(mf): use TestMain and create a proper "long" or "remote" flag. From 235a213f8298a5c62d1109536e55d91e8c5d31db Mon Sep 17 00:00:00 2001 From: Ffaen Date: Tue, 2 May 2023 15:37:16 +0100 Subject: [PATCH 02/11] Add 'sqlserver' to dialects as an alias of mssql (#510) --- dialect.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dialect.go b/dialect.go index 385b562d2..6c94b9b06 100644 --- a/dialect.go +++ b/dialect.go @@ -22,7 +22,7 @@ func SetDialect(s string) error { d = dialect.Mysql case "sqlite3", "sqlite": d = dialect.Sqlite3 - case "mssql", "azuresql": + case "mssql", "azuresql", "sqlserver": d = dialect.Sqlserver case "redshift": d = dialect.Redshift From a82016825bb733d36188fb344e0c0ebe2db82a0f Mon Sep 17 00:00:00 2001 From: Michael Fridman Date: Fri, 5 May 2023 08:35:06 -0400 Subject: [PATCH 03/11] docs: add goose validate command to help and readme (#512) --- README.md | 26 +++++++++++++++----------- cmd/goose/main.go | 1 + 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 28f9ddf67..ea1538dea 100644 --- a/README.md +++ b/README.md @@ -13,21 +13,22 @@ Goose supports [embedding SQL migrations](#embedded-sql-migrations), which means ### Goals of this fork `github.com/pressly/goose` is a fork of `bitbucket.org/liamstask/goose` with the following changes: + - No config files - [Default goose binary](./cmd/goose/main.go) can migrate SQL files only - Go migrations: - - We don't `go build` Go migrations functions on-the-fly - from within the goose binary - - Instead, we let you - [create your own custom goose binary](examples/go-migrations), - register your Go migration functions explicitly and run complex - migrations with your own `*sql.DB` connection - - Go migration functions let you run your code within - an SQL transaction, if you use the `*sql.Tx` argument + - We don't `go build` Go migrations functions on-the-fly + from within the goose binary + - Instead, we let you + [create your own custom goose binary](examples/go-migrations), + register your Go migration functions explicitly and run complex + migrations with your own `*sql.DB` connection + - Go migration functions let you run your code within + an SQL transaction, if you use the `*sql.Tx` argument - The goose pkg is decoupled from the binary: - - goose pkg doesn't register any SQL drivers anymore, - thus no driver `panic()` conflict within your codebase! - - goose pkg doesn't have any vendor dependencies anymore + - goose pkg doesn't register any SQL drivers anymore, + thus no driver `panic()` conflict within your codebase! + - goose pkg doesn't have any vendor dependencies anymore - We use timestamped migrations by default but recommend a hybrid approach of using timestamps in the development process and sequential versions in production. - Supports missing (out-of-order) migrations with the `-allow-missing` flag, or if using as a library supply the functional option `goose.WithAllowMissing()` to Up, UpTo or UpByOne. - Supports applying ad-hoc migrations without tracking them in the schema table. Useful for seeding a database after migrations have been applied. Use `-no-versioning` flag or the functional option `goose.WithNoVersioning()`. @@ -112,6 +113,7 @@ Commands: version Print the current version of the database create NAME [sql|go] Creates new migration file with the current timestamp fix Apply sequential ordering to migrations + validate Check migration files without running them ``` ## create @@ -255,6 +257,7 @@ language plpgsql; ``` ## Embedded sql migrations + Go 1.16 introduced new feature: [compile-time embedding](https://pkg.go.dev/embed/) files into binary and corresponding [filesystem abstraction](https://pkg.go.dev/io/fs/). @@ -350,6 +353,7 @@ DOCKER_BUILDKIT=1 docker build -f Dockerfile.local --output bin . ``` # Hybrid Versioning + Please, read the [versioning problem](https://github.com/pressly/goose/issues/63#issuecomment-428681694) first. By default, if you attempt to apply missing (out-of-order) migrations `goose` will raise an error. However, If you want to apply these missing migrations pass goose the `-allow-missing` flag, or if using as a library supply the functional option `goose.WithAllowMissing()` to Up, UpTo or UpByOne. diff --git a/cmd/goose/main.go b/cmd/goose/main.go index 489e096ce..913e07cfb 100644 --- a/cmd/goose/main.go +++ b/cmd/goose/main.go @@ -241,6 +241,7 @@ Commands: version Print the current version of the database create NAME [sql|go] Creates new migration file with the current timestamp fix Apply sequential ordering to migrations + validate Check migration files without running them ` ) From 93e0cdba9b0897443aab09b0620d0a05d871744d Mon Sep 17 00:00:00 2001 From: Michael Fridman Date: Mon, 8 May 2023 08:17:14 -0400 Subject: [PATCH 04/11] fix: use global table name in queries (#515) --- dialect.go | 4 +- internal/dialect/dialectquery/clickhouse.go | 18 ++--- internal/dialect/dialectquery/dialectquery.go | 10 +-- internal/dialect/dialectquery/mysql.go | 24 ++++--- internal/dialect/dialectquery/postgres.go | 24 ++++--- internal/dialect/dialectquery/redshift.go | 24 ++++--- internal/dialect/dialectquery/sqlite3.go | 24 ++++--- internal/dialect/dialectquery/sqlserver.go | 24 ++++--- internal/dialect/dialectquery/tidb.go | 24 ++++--- internal/dialect/dialectquery/vertica.go | 24 ++++--- internal/dialect/store.go | 66 +++++++++---------- migrate.go | 6 +- migration.go | 8 +-- migration_sql.go | 8 +-- reset.go | 2 +- status.go | 2 +- up.go | 2 +- 17 files changed, 137 insertions(+), 157 deletions(-) diff --git a/dialect.go b/dialect.go index 6c94b9b06..4e53e61ab 100644 --- a/dialect.go +++ b/dialect.go @@ -7,7 +7,7 @@ import ( ) func init() { - store, _ = dialect.NewStore(dialect.Postgres, TableName()) + store, _ = dialect.NewStore(dialect.Postgres) } var store dialect.Store @@ -36,7 +36,7 @@ func SetDialect(s string) error { return fmt.Errorf("%q: unknown dialect", s) } var err error - store, err = dialect.NewStore(d, TableName()) + store, err = dialect.NewStore(d) return err } diff --git a/internal/dialect/dialectquery/clickhouse.go b/internal/dialect/dialectquery/clickhouse.go index ea8cb9fb7..70e58e0e6 100644 --- a/internal/dialect/dialectquery/clickhouse.go +++ b/internal/dialect/dialectquery/clickhouse.go @@ -23,7 +23,7 @@ type Clickhouse struct { var _ Querier = (*Clickhouse)(nil) -func (c *Clickhouse) CreateTable() string { +func (c *Clickhouse) CreateTable(tableName string) string { q := `CREATE TABLE IF NOT EXISTS %s ( version_id Int64, is_applied UInt8, @@ -48,24 +48,24 @@ func (c *Clickhouse) CreateTable() string { return fmt.Sprintf(q, c.Table) } -func (c *Clickhouse) InsertVersion() string { +func (c *Clickhouse) InsertVersion(tableName string) string { q := `INSERT INTO %s (version_id, is_applied) VALUES ($1, $2)` - return fmt.Sprintf(q, c.Table) + return fmt.Sprintf(q, tableName) } -func (c *Clickhouse) DeleteVersion() string { +func (c *Clickhouse) DeleteVersion(tableName string) string { q := `ALTER TABLE %s DELETE WHERE version_id = $1 SETTINGS mutations_sync = 2` - return fmt.Sprintf(q, c.Table) + return fmt.Sprintf(q, tableName) } -func (c *Clickhouse) GetMigrationByVersion() string { +func (c *Clickhouse) GetMigrationByVersion(tableName string) string { q := `SELECT tstamp, is_applied FROM %s WHERE version_id = $1 ORDER BY tstamp DESC LIMIT 1` - return fmt.Sprintf(q, c.Table) + return fmt.Sprintf(q, tableName) } -func (c *Clickhouse) ListMigrations() string { +func (c *Clickhouse) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied FROM %s ORDER BY version_id DESC` - return fmt.Sprintf(q, c.Table) + return fmt.Sprintf(q, tableName) } func (c *Clickhouse) AttachOptions(options map[string]string) error { diff --git a/internal/dialect/dialectquery/dialectquery.go b/internal/dialect/dialectquery/dialectquery.go index 06432b4f6..d3d29eab1 100644 --- a/internal/dialect/dialectquery/dialectquery.go +++ b/internal/dialect/dialectquery/dialectquery.go @@ -4,27 +4,27 @@ package dialectquery // specific query. type Querier interface { // CreateTable returns the SQL query string to create the db version table. - CreateTable() string + CreateTable(tableName string) string // InsertVersion returns the SQL query string to insert a new version into // the db version table. - InsertVersion() string + InsertVersion(tableName string) string // DeleteVersion returns the SQL query string to delete a version from // the db version table. - DeleteVersion() string + DeleteVersion(tableName string) string // GetMigrationByVersion returns the SQL query string to get a single // migration by version. // // The query should return the timestamp and is_applied columns. - GetMigrationByVersion() string + GetMigrationByVersion(tableName string) string // ListMigrations returns the SQL query string to list all migrations in // descending order by id. // // The query should return the version_id and is_applied columns. - ListMigrations() string + ListMigrations(tableName string) string } // QuerierOptions is an interface to provide specific options to a dialect. diff --git a/internal/dialect/dialectquery/mysql.go b/internal/dialect/dialectquery/mysql.go index 6a4f0b439..25954cbc2 100644 --- a/internal/dialect/dialectquery/mysql.go +++ b/internal/dialect/dialectquery/mysql.go @@ -2,13 +2,11 @@ package dialectquery import "fmt" -type Mysql struct { - Table string -} +type Mysql struct{} var _ Querier = (*Mysql)(nil) -func (m *Mysql) CreateTable() string { +func (m *Mysql) CreateTable(tableName string) string { q := `CREATE TABLE %s ( id serial NOT NULL, version_id bigint NOT NULL, @@ -16,25 +14,25 @@ func (m *Mysql) CreateTable() string { tstamp timestamp NULL default now(), PRIMARY KEY(id) )` - return fmt.Sprintf(q, m.Table) + return fmt.Sprintf(q, tableName) } -func (m *Mysql) InsertVersion() string { +func (m *Mysql) InsertVersion(tableName string) string { q := `INSERT INTO %s (version_id, is_applied) VALUES (?, ?)` - return fmt.Sprintf(q, m.Table) + return fmt.Sprintf(q, tableName) } -func (m *Mysql) DeleteVersion() string { +func (m *Mysql) DeleteVersion(tableName string) string { q := `DELETE FROM %s WHERE version_id=?` - return fmt.Sprintf(q, m.Table) + return fmt.Sprintf(q, tableName) } -func (m *Mysql) GetMigrationByVersion() string { +func (m *Mysql) GetMigrationByVersion(tableName string) string { q := `SELECT tstamp, is_applied FROM %s WHERE version_id=? ORDER BY tstamp DESC LIMIT 1` - return fmt.Sprintf(q, m.Table) + return fmt.Sprintf(q, tableName) } -func (m *Mysql) ListMigrations() string { +func (m *Mysql) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied from %s ORDER BY id DESC` - return fmt.Sprintf(q, m.Table) + return fmt.Sprintf(q, tableName) } diff --git a/internal/dialect/dialectquery/postgres.go b/internal/dialect/dialectquery/postgres.go index 1cddeb928..5103390f4 100644 --- a/internal/dialect/dialectquery/postgres.go +++ b/internal/dialect/dialectquery/postgres.go @@ -2,13 +2,11 @@ package dialectquery import "fmt" -type Postgres struct { - Table string -} +type Postgres struct{} var _ Querier = (*Postgres)(nil) -func (p *Postgres) CreateTable() string { +func (p *Postgres) CreateTable(tableName string) string { q := `CREATE TABLE %s ( id serial NOT NULL, version_id bigint NOT NULL, @@ -16,25 +14,25 @@ func (p *Postgres) CreateTable() string { tstamp timestamp NULL default now(), PRIMARY KEY(id) )` - return fmt.Sprintf(q, p.Table) + return fmt.Sprintf(q, tableName) } -func (p *Postgres) InsertVersion() string { +func (p *Postgres) InsertVersion(tableName string) string { q := `INSERT INTO %s (version_id, is_applied) VALUES ($1, $2)` - return fmt.Sprintf(q, p.Table) + return fmt.Sprintf(q, tableName) } -func (p *Postgres) DeleteVersion() string { +func (p *Postgres) DeleteVersion(tableName string) string { q := `DELETE FROM %s WHERE version_id=$1` - return fmt.Sprintf(q, p.Table) + return fmt.Sprintf(q, tableName) } -func (p *Postgres) GetMigrationByVersion() string { +func (p *Postgres) GetMigrationByVersion(tableName string) string { q := `SELECT tstamp, is_applied FROM %s WHERE version_id=$1 ORDER BY tstamp DESC LIMIT 1` - return fmt.Sprintf(q, p.Table) + return fmt.Sprintf(q, tableName) } -func (p *Postgres) ListMigrations() string { +func (p *Postgres) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied from %s ORDER BY id DESC` - return fmt.Sprintf(q, p.Table) + return fmt.Sprintf(q, tableName) } diff --git a/internal/dialect/dialectquery/redshift.go b/internal/dialect/dialectquery/redshift.go index 8dd5fda33..006a0ca6d 100644 --- a/internal/dialect/dialectquery/redshift.go +++ b/internal/dialect/dialectquery/redshift.go @@ -2,13 +2,11 @@ package dialectquery import "fmt" -type Redshift struct { - Table string -} +type Redshift struct{} var _ Querier = (*Redshift)(nil) -func (r *Redshift) CreateTable() string { +func (r *Redshift) CreateTable(tableName string) string { q := `CREATE TABLE %s ( id integer NOT NULL identity(1, 1), version_id bigint NOT NULL, @@ -16,25 +14,25 @@ func (r *Redshift) CreateTable() string { tstamp timestamp NULL default sysdate, PRIMARY KEY(id) )` - return fmt.Sprintf(q, r.Table) + return fmt.Sprintf(q, tableName) } -func (r *Redshift) InsertVersion() string { +func (r *Redshift) InsertVersion(tableName string) string { q := `INSERT INTO %s (version_id, is_applied) VALUES ($1, $2)` - return fmt.Sprintf(q, r.Table) + return fmt.Sprintf(q, tableName) } -func (r *Redshift) DeleteVersion() string { +func (r *Redshift) DeleteVersion(tableName string) string { q := `DELETE FROM %s WHERE version_id=$1` - return fmt.Sprintf(q, r.Table) + return fmt.Sprintf(q, tableName) } -func (r *Redshift) GetMigrationByVersion() string { +func (r *Redshift) GetMigrationByVersion(tableName string) string { q := `SELECT tstamp, is_applied FROM %s WHERE version_id=$1 ORDER BY tstamp DESC LIMIT 1` - return fmt.Sprintf(q, r.Table) + return fmt.Sprintf(q, tableName) } -func (r *Redshift) ListMigrations() string { +func (r *Redshift) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied from %s ORDER BY id DESC` - return fmt.Sprintf(q, r.Table) + return fmt.Sprintf(q, tableName) } diff --git a/internal/dialect/dialectquery/sqlite3.go b/internal/dialect/dialectquery/sqlite3.go index d6526f20d..689900a72 100644 --- a/internal/dialect/dialectquery/sqlite3.go +++ b/internal/dialect/dialectquery/sqlite3.go @@ -2,38 +2,36 @@ package dialectquery import "fmt" -type Sqlite3 struct { - Table string -} +type Sqlite3 struct{} var _ Querier = (*Sqlite3)(nil) -func (s *Sqlite3) CreateTable() string { +func (s *Sqlite3) CreateTable(tableName string) string { q := `CREATE TABLE %s ( id INTEGER PRIMARY KEY AUTOINCREMENT, version_id INTEGER NOT NULL, is_applied INTEGER NOT NULL, tstamp TIMESTAMP DEFAULT (datetime('now')) )` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } -func (s *Sqlite3) InsertVersion() string { +func (s *Sqlite3) InsertVersion(tableName string) string { q := `INSERT INTO %s (version_id, is_applied) VALUES (?, ?)` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } -func (s *Sqlite3) DeleteVersion() string { +func (s *Sqlite3) DeleteVersion(tableName string) string { q := `DELETE FROM %s WHERE version_id=?` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } -func (s *Sqlite3) GetMigrationByVersion() string { +func (s *Sqlite3) GetMigrationByVersion(tableName string) string { q := `SELECT tstamp, is_applied FROM %s WHERE version_id=? ORDER BY tstamp DESC LIMIT 1` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } -func (s *Sqlite3) ListMigrations() string { +func (s *Sqlite3) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied from %s ORDER BY id DESC` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } diff --git a/internal/dialect/dialectquery/sqlserver.go b/internal/dialect/dialectquery/sqlserver.go index 63e0e53f0..0caa2f644 100644 --- a/internal/dialect/dialectquery/sqlserver.go +++ b/internal/dialect/dialectquery/sqlserver.go @@ -2,33 +2,31 @@ package dialectquery import "fmt" -type Sqlserver struct { - Table string -} +type Sqlserver struct{} var _ Querier = (*Sqlserver)(nil) -func (s *Sqlserver) CreateTable() string { +func (s *Sqlserver) CreateTable(tableName string) string { q := `CREATE TABLE %s ( id INT NOT NULL IDENTITY(1,1) PRIMARY KEY, version_id BIGINT NOT NULL, is_applied BIT NOT NULL, tstamp DATETIME NULL DEFAULT CURRENT_TIMESTAMP )` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } -func (s *Sqlserver) InsertVersion() string { +func (s *Sqlserver) InsertVersion(tableName string) string { q := `INSERT INTO %s (version_id, is_applied) VALUES (@p1, @p2)` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } -func (s *Sqlserver) DeleteVersion() string { +func (s *Sqlserver) DeleteVersion(tableName string) string { q := `DELETE FROM %s WHERE version_id=@p1` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } -func (s *Sqlserver) GetMigrationByVersion() string { +func (s *Sqlserver) GetMigrationByVersion(tableName string) string { q := ` WITH Migrations AS ( @@ -42,10 +40,10 @@ FROM Migrations WHERE RowNumber BETWEEN 1 AND 2 ORDER BY tstamp DESC ` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } -func (s *Sqlserver) ListMigrations() string { +func (s *Sqlserver) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied FROM %s ORDER BY id DESC` - return fmt.Sprintf(q, s.Table) + return fmt.Sprintf(q, tableName) } diff --git a/internal/dialect/dialectquery/tidb.go b/internal/dialect/dialectquery/tidb.go index 8b98dde44..984e60a7a 100644 --- a/internal/dialect/dialectquery/tidb.go +++ b/internal/dialect/dialectquery/tidb.go @@ -2,13 +2,11 @@ package dialectquery import "fmt" -type Tidb struct { - Table string -} +type Tidb struct{} var _ Querier = (*Tidb)(nil) -func (t *Tidb) CreateTable() string { +func (t *Tidb) CreateTable(tableName string) string { q := `CREATE TABLE %s ( id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE, version_id bigint NOT NULL, @@ -16,25 +14,25 @@ func (t *Tidb) CreateTable() string { tstamp timestamp NULL default now(), PRIMARY KEY(id) )` - return fmt.Sprintf(q, t.Table) + return fmt.Sprintf(q, tableName) } -func (t *Tidb) InsertVersion() string { +func (t *Tidb) InsertVersion(tableName string) string { q := `INSERT INTO %s (version_id, is_applied) VALUES (?, ?)` - return fmt.Sprintf(q, t.Table) + return fmt.Sprintf(q, tableName) } -func (t *Tidb) DeleteVersion() string { +func (t *Tidb) DeleteVersion(tableName string) string { q := `DELETE FROM %s WHERE version_id=?` - return fmt.Sprintf(q, t.Table) + return fmt.Sprintf(q, tableName) } -func (t *Tidb) GetMigrationByVersion() string { +func (t *Tidb) GetMigrationByVersion(tableName string) string { q := `SELECT tstamp, is_applied FROM %s WHERE version_id=? ORDER BY tstamp DESC LIMIT 1` - return fmt.Sprintf(q, t.Table) + return fmt.Sprintf(q, tableName) } -func (t *Tidb) ListMigrations() string { +func (t *Tidb) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied from %s ORDER BY id DESC` - return fmt.Sprintf(q, t.Table) + return fmt.Sprintf(q, tableName) } diff --git a/internal/dialect/dialectquery/vertica.go b/internal/dialect/dialectquery/vertica.go index 7a4025e06..4964aeaf6 100644 --- a/internal/dialect/dialectquery/vertica.go +++ b/internal/dialect/dialectquery/vertica.go @@ -2,13 +2,11 @@ package dialectquery import "fmt" -type Vertica struct { - Table string -} +type Vertica struct{} var _ Querier = (*Vertica)(nil) -func (v *Vertica) CreateTable() string { +func (v *Vertica) CreateTable(tableName string) string { q := `CREATE TABLE %s ( id identity(1,1) NOT NULL, version_id bigint NOT NULL, @@ -16,25 +14,25 @@ func (v *Vertica) CreateTable() string { tstamp timestamp NULL default now(), PRIMARY KEY(id) )` - return fmt.Sprintf(q, v.Table) + return fmt.Sprintf(q, tableName) } -func (v *Vertica) InsertVersion() string { +func (v *Vertica) InsertVersion(tableName string) string { q := `INSERT INTO %s (version_id, is_applied) VALUES (?, ?)` - return fmt.Sprintf(q, v.Table) + return fmt.Sprintf(q, tableName) } -func (v *Vertica) DeleteVersion() string { +func (v *Vertica) DeleteVersion(tableName string) string { q := `DELETE FROM %s WHERE version_id=?` - return fmt.Sprintf(q, v.Table) + return fmt.Sprintf(q, tableName) } -func (v *Vertica) GetMigrationByVersion() string { +func (v *Vertica) GetMigrationByVersion(tableName string) string { q := `SELECT tstamp, is_applied FROM %s WHERE version_id=? ORDER BY tstamp DESC LIMIT 1` - return fmt.Sprintf(q, v.Table) + return fmt.Sprintf(q, tableName) } -func (v *Vertica) ListMigrations() string { +func (v *Vertica) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied from %s ORDER BY id DESC` - return fmt.Sprintf(q, v.Table) + return fmt.Sprintf(q, tableName) } diff --git a/internal/dialect/store.go b/internal/dialect/store.go index 4cb4e20c2..0c6b12fbd 100644 --- a/internal/dialect/store.go +++ b/internal/dialect/store.go @@ -3,7 +3,6 @@ package dialect import ( "context" "database/sql" - "errors" "fmt" "time" @@ -22,28 +21,28 @@ import ( type Store interface { // CreateVersionTable creates the version table within a transaction. // This table is used to store goose migrations. - CreateVersionTable(ctx context.Context, tx *sql.Tx) error + CreateVersionTable(ctx context.Context, tx *sql.Tx, tableName string) error // InsertVersion inserts a version id into the version table within a transaction. - InsertVersion(ctx context.Context, tx *sql.Tx, version int64) error + InsertVersion(ctx context.Context, tx *sql.Tx, tableName string, version int64) error // InsertVersionNoTx inserts a version id into the version table without a transaction. - InsertVersionNoTx(ctx context.Context, db *sql.DB, version int64) error + InsertVersionNoTx(ctx context.Context, db *sql.DB, tableName string, version int64) error // DeleteVersion deletes a version id from the version table within a transaction. - DeleteVersion(ctx context.Context, tx *sql.Tx, version int64) error + DeleteVersion(ctx context.Context, tx *sql.Tx, tableName string, version int64) error // DeleteVersionNoTx deletes a version id from the version table without a transaction. - DeleteVersionNoTx(ctx context.Context, db *sql.DB, version int64) error + DeleteVersionNoTx(ctx context.Context, db *sql.DB, tableName string, version int64) error // GetMigrationRow retrieves a single migration by version id. // // Returns the raw sql error if the query fails. It is the callers responsibility // to assert for the correct error, such as sql.ErrNoRows. - GetMigration(ctx context.Context, db *sql.DB, version int64) (*GetMigrationResult, error) + GetMigration(ctx context.Context, db *sql.DB, tableName string, version int64) (*GetMigrationResult, error) // ListMigrations retrieves all migrations sorted in descending order by id. // // If there are no migrations, an empty slice is returned with no error. - ListMigrations(ctx context.Context, db *sql.DB) ([]*ListMigrationsResult, error) + ListMigrations(ctx context.Context, db *sql.DB, tableName string) ([]*ListMigrationsResult, error) } type StoreOptions interface { @@ -51,30 +50,25 @@ type StoreOptions interface { } // NewStore returns a new Store for the given dialect. -// -// The table name is used to store the goose migrations. -func NewStore(d Dialect, table string) (Store, error) { - if table == "" { - return nil, errors.New("table name cannot be empty") - } +func NewStore(d Dialect) (Store, error) { var querier dialectquery.Querier switch d { case Postgres: - querier = &dialectquery.Postgres{Table: table} + querier = &dialectquery.Postgres{} case Mysql: - querier = &dialectquery.Mysql{Table: table} + querier = &dialectquery.Mysql{} case Sqlite3: - querier = &dialectquery.Sqlite3{Table: table} + querier = &dialectquery.Sqlite3{} case Sqlserver: - querier = &dialectquery.Sqlserver{Table: table} + querier = &dialectquery.Sqlserver{} case Redshift: - querier = &dialectquery.Redshift{Table: table} + querier = &dialectquery.Redshift{} case Tidb: - querier = &dialectquery.Tidb{Table: table} + querier = &dialectquery.Tidb{} case Clickhouse: - querier = &dialectquery.Clickhouse{Table: table} + querier = &dialectquery.Clickhouse{} case Vertica: - querier = &dialectquery.Vertica{Table: table} + querier = &dialectquery.Vertica{} default: return nil, fmt.Errorf("unknown querier dialect: %v", d) } @@ -97,38 +91,38 @@ type store struct { var _ Store = (*store)(nil) -func (s *store) CreateVersionTable(ctx context.Context, tx *sql.Tx) error { - q := s.querier.CreateTable() +func (s *store) CreateVersionTable(ctx context.Context, tx *sql.Tx, tableName string) error { + q := s.querier.CreateTable(tableName) _, err := tx.ExecContext(ctx, q) return err } -func (s *store) InsertVersion(ctx context.Context, tx *sql.Tx, version int64) error { - q := s.querier.InsertVersion() +func (s *store) InsertVersion(ctx context.Context, tx *sql.Tx, tableName string, version int64) error { + q := s.querier.InsertVersion(tableName) _, err := tx.ExecContext(ctx, q, version, true) return err } -func (s *store) InsertVersionNoTx(ctx context.Context, db *sql.DB, version int64) error { - q := s.querier.InsertVersion() +func (s *store) InsertVersionNoTx(ctx context.Context, db *sql.DB, tableName string, version int64) error { + q := s.querier.InsertVersion(tableName) _, err := db.ExecContext(ctx, q, version, true) return err } -func (s *store) DeleteVersion(ctx context.Context, tx *sql.Tx, version int64) error { - q := s.querier.DeleteVersion() +func (s *store) DeleteVersion(ctx context.Context, tx *sql.Tx, tableName string, version int64) error { + q := s.querier.DeleteVersion(tableName) _, err := tx.ExecContext(ctx, q, version) return err } -func (s *store) DeleteVersionNoTx(ctx context.Context, db *sql.DB, version int64) error { - q := s.querier.DeleteVersion() +func (s *store) DeleteVersionNoTx(ctx context.Context, db *sql.DB, tableName string, version int64) error { + q := s.querier.DeleteVersion(tableName) _, err := db.ExecContext(ctx, q, version) return err } -func (s *store) GetMigration(ctx context.Context, db *sql.DB, version int64) (*GetMigrationResult, error) { - q := s.querier.GetMigrationByVersion() +func (s *store) GetMigration(ctx context.Context, db *sql.DB, tableName string, version int64) (*GetMigrationResult, error) { + q := s.querier.GetMigrationByVersion(tableName) var timestamp time.Time var isApplied bool err := db.QueryRowContext(ctx, q, version).Scan(×tamp, &isApplied) @@ -141,8 +135,8 @@ func (s *store) GetMigration(ctx context.Context, db *sql.DB, version int64) (*G }, nil } -func (s *store) ListMigrations(ctx context.Context, db *sql.DB) ([]*ListMigrationsResult, error) { - q := s.querier.ListMigrations() +func (s *store) ListMigrations(ctx context.Context, db *sql.DB, tableName string) ([]*ListMigrationsResult, error) { + q := s.querier.ListMigrations(tableName) rows, err := db.QueryContext(ctx, q) if err != nil { return nil, err diff --git a/migrate.go b/migrate.go index baf6680ac..0cf96a860 100644 --- a/migrate.go +++ b/migrate.go @@ -296,7 +296,7 @@ func versionFilter(v, current, target int64) bool { // Create and initialize the DB version table if it doesn't exist. func EnsureDBVersion(db *sql.DB) (int64, error) { ctx := context.Background() - dbMigrations, err := store.ListMigrations(ctx, db) + dbMigrations, err := store.ListMigrations(ctx, db, TableName()) if err != nil { return 0, createVersionTable(ctx, db) } @@ -336,11 +336,11 @@ func createVersionTable(ctx context.Context, db *sql.DB) error { if err != nil { return err } - if err := store.CreateVersionTable(ctx, txn); err != nil { + if err := store.CreateVersionTable(ctx, txn, TableName()); err != nil { _ = txn.Rollback() return err } - if err := store.InsertVersion(ctx, txn, 0); err != nil { + if err := store.InsertVersion(ctx, txn, TableName(), 0); err != nil { _ = txn.Rollback() return err } diff --git a/migration.go b/migration.go index f3727338e..727ecc3d9 100644 --- a/migration.go +++ b/migration.go @@ -188,16 +188,16 @@ func runGoMigration( func insertOrDeleteVersion(ctx context.Context, tx *sql.Tx, version int64, direction bool) error { if direction { - return store.InsertVersion(ctx, tx, version) + return store.InsertVersion(ctx, tx, TableName(), version) } - return store.DeleteVersion(ctx, tx, version) + return store.DeleteVersion(ctx, tx, TableName(), version) } func insertOrDeleteVersionNoTx(ctx context.Context, db *sql.DB, version int64, direction bool) error { if direction { - return store.InsertVersionNoTx(ctx, db, version) + return store.InsertVersionNoTx(ctx, db, TableName(), version) } - return store.DeleteVersionNoTx(ctx, db, version) + return store.DeleteVersionNoTx(ctx, db, TableName(), version) } // NumericComponent looks for migration scripts with names in the form: diff --git a/migration_sql.go b/migration_sql.go index d45fa64b5..f74b70d75 100644 --- a/migration_sql.go +++ b/migration_sql.go @@ -45,13 +45,13 @@ func runSQLMigration( if !noVersioning { if direction { - if err := store.InsertVersion(ctx, tx, v); err != nil { + if err := store.InsertVersion(ctx, tx, TableName(), v); err != nil { verboseInfo("Rollback transaction") _ = tx.Rollback() return fmt.Errorf("failed to insert new goose version: %w", err) } } else { - if err := store.DeleteVersion(ctx, tx, v); err != nil { + if err := store.DeleteVersion(ctx, tx, TableName(), v); err != nil { verboseInfo("Rollback transaction") _ = tx.Rollback() return fmt.Errorf("failed to delete goose version: %w", err) @@ -76,11 +76,11 @@ func runSQLMigration( } if !noVersioning { if direction { - if err := store.InsertVersionNoTx(ctx, db, v); err != nil { + if err := store.InsertVersionNoTx(ctx, db, TableName(), v); err != nil { return fmt.Errorf("failed to insert new goose version: %w", err) } } else { - if err := store.DeleteVersionNoTx(ctx, db, v); err != nil { + if err := store.DeleteVersionNoTx(ctx, db, TableName(), v); err != nil { return fmt.Errorf("failed to delete goose version: %w", err) } } diff --git a/reset.go b/reset.go index 7be46179c..e14d36d22 100644 --- a/reset.go +++ b/reset.go @@ -41,7 +41,7 @@ func Reset(db *sql.DB, dir string, opts ...OptionsFunc) error { } func dbMigrationsStatus(ctx context.Context, db *sql.DB) (map[int64]bool, error) { - dbMigrations, err := store.ListMigrations(ctx, db) + dbMigrations, err := store.ListMigrations(ctx, db, TableName()) if err != nil { return nil, err } diff --git a/status.go b/status.go index 73e73decf..dd1f16c4c 100644 --- a/status.go +++ b/status.go @@ -46,7 +46,7 @@ func Status(db *sql.DB, dir string, opts ...OptionsFunc) error { } func printMigrationStatus(ctx context.Context, db *sql.DB, version int64, script string) error { - m, err := store.GetMigration(ctx, db, version) + m, err := store.GetMigration(ctx, db, TableName(), version) if err != nil && !errors.Is(err, sql.ErrNoRows) { return fmt.Errorf("failed to query the latest migration: %w", err) } diff --git a/up.go b/up.go index bc8ddc789..66ba2d6fe 100644 --- a/up.go +++ b/up.go @@ -225,7 +225,7 @@ func UpByOne(db *sql.DB, dir string, opts ...OptionsFunc) error { // listAllDBVersions returns a list of all migrations, ordered ascending. // TODO(mf): fairly cheap, but a nice-to-have is pagination support. func listAllDBVersions(ctx context.Context, db *sql.DB) (Migrations, error) { - dbMigrations, err := store.ListMigrations(ctx, db) + dbMigrations, err := store.ListMigrations(ctx, db, TableName()) if err != nil { return nil, err } From b37f6e87dea7333abf13944c35c674e23981bf29 Mon Sep 17 00:00:00 2001 From: Michael Fridman Date: Mon, 8 May 2023 08:27:39 -0400 Subject: [PATCH 05/11] build: upgrade deps (#516) --- go.mod | 35 +++++++++++++------------- go.sum | 79 +++++++++++++++++++++++++++++----------------------------- 2 files changed, 56 insertions(+), 58 deletions(-) diff --git a/go.mod b/go.mod index 862702b6e..1147b5456 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/pressly/goose/v3 go 1.20 require ( - github.com/ClickHouse/clickhouse-go/v2 v2.9.0 - github.com/go-sql-driver/mysql v1.7.0 + github.com/ClickHouse/clickhouse-go/v2 v2.9.1 + github.com/go-sql-driver/mysql v1.7.1 github.com/google/go-cmp v0.5.9 github.com/jackc/pgx/v5 v5.3.1 github.com/microsoft/go-mssqldb v0.21.0 @@ -13,23 +13,23 @@ require ( github.com/testcontainers/testcontainers-go v0.19.0 github.com/vertica/vertica-sql-go v1.3.2 github.com/ziutek/mymysql v1.5.4 - modernc.org/sqlite v1.21.1 + modernc.org/sqlite v1.22.1 ) require ( github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect - github.com/ClickHouse/ch-go v0.54.0 // indirect + github.com/ClickHouse/ch-go v0.55.0 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect github.com/andybalholm/brotli v1.0.5 // indirect - github.com/cenkalti/backoff/v4 v4.2.0 // indirect + github.com/cenkalti/backoff/v4 v4.2.1 // indirect github.com/containerd/containerd v1.6.19 // indirect github.com/containerd/continuity v0.3.0 // indirect github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/docker/cli v23.0.3+incompatible // indirect + github.com/docker/cli v23.0.6+incompatible // indirect github.com/docker/distribution v2.8.1+incompatible // indirect - github.com/docker/docker v23.0.3+incompatible // indirect + github.com/docker/docker v23.0.6+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect @@ -48,37 +48,36 @@ require ( github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect - github.com/klauspost/compress v1.16.4 // indirect - github.com/lib/pq v1.10.7 // indirect + github.com/klauspost/compress v1.16.5 // indirect + github.com/lib/pq v1.10.9 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-isatty v0.0.18 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moby/patternmatcher v0.5.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect - github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect + github.com/moby/term v0.5.0 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc2 // indirect - github.com/opencontainers/runc v1.1.6 // indirect - github.com/paulmach/orb v0.9.0 // indirect + github.com/opencontainers/image-spec v1.1.0-rc3 // indirect + github.com/opencontainers/runc v1.1.7 // indirect + github.com/paulmach/orb v0.9.2 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect - github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect - go.opentelemetry.io/otel v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect + go.opentelemetry.io/otel v1.15.1 // indirect + go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/crypto v0.8.0 // indirect golang.org/x/mod v0.10.0 // indirect golang.org/x/net v0.9.0 // indirect - golang.org/x/sys v0.7.0 // indirect + golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect golang.org/x/tools v0.8.0 // indirect google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad // indirect @@ -90,7 +89,7 @@ require ( lukechampine.com/uint128 v1.3.0 // indirect modernc.org/cc/v3 v3.40.0 // indirect modernc.org/ccgo/v3 v3.16.13 // indirect - modernc.org/libc v1.22.3 // indirect + modernc.org/libc v1.22.5 // indirect modernc.org/mathutil v1.5.0 // indirect modernc.org/memory v1.5.0 // indirect modernc.org/opt v0.1.3 // indirect diff --git a/go.sum b/go.sum index a03056045..547a21c79 100644 --- a/go.sum +++ b/go.sum @@ -8,10 +8,10 @@ github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25 github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1/go.mod h1:4qFor3D/HDsvBME35Xy9rwW9DecL+M2sNw1ybjPtwA0= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/ClickHouse/ch-go v0.54.0 h1:WzPo/iZ8Gchb9Ze30TywMheOzKW5FkhTeZPxvz/iE6o= -github.com/ClickHouse/ch-go v0.54.0/go.mod h1:2jvyjBRb5zhzFvcOBxPelzpbB9qsS47vwJssurJe2OA= -github.com/ClickHouse/clickhouse-go/v2 v2.9.0 h1:vh0D+9p5hKWLYqCfU8Hd7/GMXNfHC84isUf7sNlJrZk= -github.com/ClickHouse/clickhouse-go/v2 v2.9.0/go.mod h1:teXfZNM90iQ99Jnuht+dxQXCuhDZ8nvvMoTJOFrcmcg= +github.com/ClickHouse/ch-go v0.55.0 h1:jw4Tpx887YXrkyL5DfgUome/po8MLz92nz2heOQ6RjQ= +github.com/ClickHouse/ch-go v0.55.0/go.mod h1:kQT2f+yp2p+sagQA/7kS6G3ukym+GQ5KAu1kuFAFDiU= +github.com/ClickHouse/clickhouse-go/v2 v2.9.1 h1:IeE2bwVvAba7Yw5ZKu98bKI4NpDmykEy6jUaQdJJCk8= +github.com/ClickHouse/clickhouse-go/v2 v2.9.1/go.mod h1:teXfZNM90iQ99Jnuht+dxQXCuhDZ8nvvMoTJOFrcmcg= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.9.7 h1:mKNHW/Xvv1aFH87Jb6ERDzXTJTLPlmzfZ28VBFD/bfg= @@ -20,8 +20,8 @@ github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8 github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= -github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= +github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= @@ -43,12 +43,12 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/cli v23.0.3+incompatible h1:Zcse1DuDqBdgI7OQDV8Go7b83xLgfhW1eza4HfEdxpY= -github.com/docker/cli v23.0.3+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v23.0.6+incompatible h1:CScadyCJ2ZKUDpAMZta6vK8I+6/m60VIjGIV7Wg/Eu4= +github.com/docker/cli v23.0.6+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v23.0.3+incompatible h1:9GhVsShNWz1hO//9BNg/dpMnZW25KydO4wtVxWAIbho= -github.com/docker/docker v23.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v23.0.6+incompatible h1:aBD4np894vatVX99UTx/GyOUOK4uEcROwA3+bQhEcoU= +github.com/docker/docker v23.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -72,8 +72,8 @@ github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw= github.com/go-faster/errors v0.6.1 h1:nNIPOBkprlKzkThvS/0YaX8Zs9KewLCOSFQS5BU06FI= github.com/go-faster/errors v0.6.1/go.mod h1:5MGV2/2T9yvlrbhe9pD9LO5Z/2zCSq2T8j+Jpi2LAyY= -github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= -github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= +github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= @@ -142,16 +142,16 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:C github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= -github.com/klauspost/compress v1.16.4 h1:91KN02FnsOYhuunwU4ssRe8lc2JosWmizWa91B5v1PU= -github.com/klauspost/compress v1.16.4/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= +github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= +github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= +github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= @@ -165,8 +165,8 @@ github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= -github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= -github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= @@ -174,14 +174,14 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= -github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= -github.com/opencontainers/runc v1.1.6 h1:XbhB8IfG/EsnhNvZtNdLB0GBw92GYEFvKlhaJk9jUgA= -github.com/opencontainers/runc v1.1.6/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= +github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8= +github.com/opencontainers/image-spec v1.1.0-rc3/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= +github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= -github.com/paulmach/orb v0.9.0 h1:MwA1DqOKtvCgm7u9RZ/pnYejTeDJPnr0+0oFajBbJqk= -github.com/paulmach/orb v0.9.0/go.mod h1:SudmOk85SXtmXAB3sLGyJ6tZy/8pdfrV0o6ef98Xc30= +github.com/paulmach/orb v0.9.2 h1:p/YWV2uJwamAynnDOJGNbPBVtDHj3vG51k9tR1rFwJE= +github.com/paulmach/orb v0.9.2/go.mod h1:5mULz1xQfs3bmQm63QEJA6lNGujuRafwA5S/EnuLaLU= github.com/paulmach/protoscan v0.2.1/go.mod h1:SpcSwydNLrxUGSDvXvO0P7g7AuhJ7lcKfDlhJCDw2gY= github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc= github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= @@ -200,8 +200,7 @@ github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qq github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= @@ -240,11 +239,11 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= -go.mongodb.org/mongo-driver v1.11.1/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sfd6Rp2HBB8= -go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= -go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= -go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= -go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= +go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g= +go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8= +go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc= +go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY= +go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -309,8 +308,8 @@ golang.org/x/sys v0.0.0-20220224120231-95c6836cb0e7/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= -golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -395,19 +394,19 @@ modernc.org/ccgo/v3 v3.16.13 h1:Mkgdzl46i5F/CNR/Kj80Ri59hC8TKAhZrYSaqvkwzUw= modernc.org/ccgo/v3 v3.16.13/go.mod h1:2Quk+5YgpImhPjv2Qsob1DnZ/4som1lJTodubIcoUkY= modernc.org/ccorpus v1.11.6 h1:J16RXiiqiCgua6+ZvQot4yUuUy8zxgqbqEEUuGPlISk= modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= -modernc.org/libc v1.22.3 h1:D/g6O5ftAfavceqlLOFwaZuA5KYafKwmr30A6iSqoyY= -modernc.org/libc v1.22.3/go.mod h1:MQrloYP209xa2zHome2a8HLiLm6k0UT8CoHpV74tOFw= +modernc.org/libc v1.22.5 h1:91BNch/e5B0uPbJFgqbxXuOnxBQjlS//icfQEGmvyjE= +modernc.org/libc v1.22.5/go.mod h1:jj+Z7dTNX8fBScMVNRAYZ/jF91K8fdT2hYMThc3YjBY= modernc.org/mathutil v1.5.0 h1:rV0Ko/6SfM+8G+yKiyI830l3Wuz1zRutdslNoQ0kfiQ= modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/memory v1.5.0 h1:N+/8c5rE6EqugZwHii4IFsaJ7MUhoWX07J5tC/iI5Ds= modernc.org/memory v1.5.0/go.mod h1:PkUhL0Mugw21sHPeskwZW4D6VscE/GQJOnIpCnW6pSU= modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4= modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/sqlite v1.21.1 h1:GyDFqNnESLOhwwDRaHGdp2jKLDzpyT/rNLglX3ZkMSU= -modernc.org/sqlite v1.21.1/go.mod h1:XwQ0wZPIh1iKb5mkvCJ3szzbhk+tykC8ZWqTRTgYRwI= +modernc.org/sqlite v1.22.1 h1:P2+Dhp5FR1RlVRkQ3dDfCiv3Ok8XPxqpe70IjYVA9oE= +modernc.org/sqlite v1.22.1/go.mod h1:OrDj17Mggn6MhE+iPbBNf7RGKODDE9NFT0f3EwDzJqk= modernc.org/strutil v1.1.3 h1:fNMm+oJklMGYfU9Ylcywl0CO5O6nTfaowNsh2wpPjzY= modernc.org/strutil v1.1.3/go.mod h1:MEHNA7PdEnEwLvspRMtWTNnp2nnyvMfkimT1NKNAGbw= -modernc.org/tcl v1.15.1 h1:mOQwiEK4p7HruMZcwKTZPw/aqtGM4aY00uzWhlKKYws= +modernc.org/tcl v1.15.2 h1:C4ybAYCGJw968e+Me18oW55kD/FexcHbqH2xak1ROSY= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.7.0 h1:xkDw/KepgEjeizO2sNco+hqYkU12taxQFqPEmgm1GWE= +modernc.org/z v1.7.3 h1:zDJf6iHjrnB+WRD88stbXokugjyc0/pB91ri1gO6LZY= From 8144d0670a562625bfbd7be84d742386b3e6e335 Mon Sep 17 00:00:00 2001 From: Mike Fridman Date: Mon, 8 May 2023 08:43:09 -0400 Subject: [PATCH 06/11] build: update actions/setup-go in goreleaser --- .github/workflows/goreleaser.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml index 50317709d..1bba4117b 100644 --- a/.github/workflows/goreleaser.yml +++ b/.github/workflows/goreleaser.yml @@ -14,11 +14,9 @@ jobs: with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v3 + uses: actions/setup-go@v4 with: - go-version: "1.20.x" - check-latest: true - cache: true + go-version: "stable" - name: Run GoReleaser uses: goreleaser/goreleaser-action@v3 with: From 0debc41edcf1407ce1c46c8d89ff6df9bb4cae8c Mon Sep 17 00:00:00 2001 From: "arun.sori" Date: Mon, 8 May 2023 18:48:22 +0200 Subject: [PATCH 07/11] Fix list migrations query for ClickHouse to get the latest applied migration --- internal/dialect/dialectquery/clickhouse.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/dialect/dialectquery/clickhouse.go b/internal/dialect/dialectquery/clickhouse.go index 70e58e0e6..aac0dd430 100644 --- a/internal/dialect/dialectquery/clickhouse.go +++ b/internal/dialect/dialectquery/clickhouse.go @@ -64,8 +64,8 @@ func (c *Clickhouse) GetMigrationByVersion(tableName string) string { } func (c *Clickhouse) ListMigrations(tableName string) string { - q := `SELECT version_id, is_applied FROM %s ORDER BY version_id DESC` - return fmt.Sprintf(q, tableName) + q := `SELECT version_id, is_applied FROM %s ORDER BY tstamp DESC` + return fmt.Sprintf(q, c.Table) } func (c *Clickhouse) AttachOptions(options map[string]string) error { From ffbcf8b0673603c14e779e88267edf879cf45b3e Mon Sep 17 00:00:00 2001 From: "arun.sori" Date: Tue, 9 May 2023 13:59:21 +0200 Subject: [PATCH 08/11] Use keepermap engine for storing versions and insert order more deterministic with time in nanos --- internal/dialect/dialectquery/clickhouse.go | 32 ++----- .../dialectquery/clickhouse_dialect_test.go | 42 ++------- migration_sql.go | 1 + tests/clickhouse/clickhouse-replicated.xml | 1 + tests/clickhouse/clickhouse_test.go | 86 +++++++++---------- 5 files changed, 60 insertions(+), 102 deletions(-) diff --git a/internal/dialect/dialectquery/clickhouse.go b/internal/dialect/dialectquery/clickhouse.go index aac0dd430..10fd46349 100644 --- a/internal/dialect/dialectquery/clickhouse.go +++ b/internal/dialect/dialectquery/clickhouse.go @@ -4,16 +4,12 @@ import "fmt" const ( paramOnCluster = "ON_CLUSTER" - paramZooPath = "ZOO_PATH" paramClusterMacro = "CLUSTER_MACRO" - paramReplicaMacro = "REPLICA_MACRO" ) type clusterParameters struct { OnCluster bool - ZooPath string ClusterMacro string - ReplicaMacro string } type Clickhouse struct { @@ -28,24 +24,24 @@ func (c *Clickhouse) CreateTable(tableName string) string { version_id Int64, is_applied UInt8, date Date default now(), - tstamp DateTime default now() + tstamp DateTime64(9, 'UTC') default now64(9, 'UTC') ) - ENGINE = MergeTree() - ORDER BY (date)` + ENGINE = KeeperMap('/goose_version') + PRIMARY KEY version_id` qCluster := `CREATE TABLE IF NOT EXISTS %s ON CLUSTER '%s' ( version_id Int64, is_applied UInt8, date Date default now(), - tstamp DateTime('UTC') default now() + tstamp DateTime64(9, 'UTC') default now64(9, 'UTC') ) - ENGINE = ReplicatedMergeTree('%s', '%s') - ORDER BY (date)` + ENGINE = KeeperMap('/goose_version_repl') + PRIMARY KEY version_id` if c.Params.OnCluster { - return fmt.Sprintf(qCluster, c.Table, c.Params.ClusterMacro, c.Params.ZooPath, c.Params.ReplicaMacro) + return fmt.Sprintf(qCluster, tableName, c.Params.ClusterMacro) } - return fmt.Sprintf(q, c.Table) + return fmt.Sprintf(q, tableName) } func (c *Clickhouse) InsertVersion(tableName string) string { @@ -65,7 +61,7 @@ func (c *Clickhouse) GetMigrationByVersion(tableName string) string { func (c *Clickhouse) ListMigrations(tableName string) string { q := `SELECT version_id, is_applied FROM %s ORDER BY tstamp DESC` - return fmt.Sprintf(q, c.Table) + return fmt.Sprintf(q, tableName) } func (c *Clickhouse) AttachOptions(options map[string]string) error { @@ -75,17 +71,7 @@ func (c *Clickhouse) AttachOptions(options map[string]string) error { if !ok { clusterMacro = "{cluster}" } - zooPath, ok := options[paramZooPath] - if !ok { - zooPath = fmt.Sprintf("/clickhouse/tables/%s/{table}", clusterMacro) - } - replicaMacro, ok := options[paramReplicaMacro] - if !ok { - replicaMacro = "{replica}" - } - c.Params.ZooPath = zooPath c.Params.ClusterMacro = clusterMacro - c.Params.ReplicaMacro = replicaMacro c.Params.OnCluster = true } } diff --git a/internal/dialect/dialectquery/clickhouse_dialect_test.go b/internal/dialect/dialectquery/clickhouse_dialect_test.go index 0a324da4d..cf0b89113 100644 --- a/internal/dialect/dialectquery/clickhouse_dialect_test.go +++ b/internal/dialect/dialectquery/clickhouse_dialect_test.go @@ -17,46 +17,40 @@ func TestClickhouseCreateTable(t *testing.T) { tests := []testData{ { clickhouse: &Clickhouse{ - Table: "schema_migrations", Params: clusterParameters{ OnCluster: true, - ZooPath: "/clickhouse/tables/{cluster}/{table}", ClusterMacro: "{cluster}", - ReplicaMacro: "{replica}", }, }, result: `CREATE TABLE IF NOT EXISTS schema_migrations ON CLUSTER '{cluster}' ( version_id Int64, is_applied UInt8, date Date default now(), - tstamp DateTime('UTC') default now() + tstamp DateTime64(9, 'UTC') default now64(9, 'UTC') ) - ENGINE = ReplicatedMergeTree('/clickhouse/tables/{cluster}/{table}', '{replica}') - ORDER BY (date)`, + ENGINE = KeeperMap('/goose_version_repl') + PRIMARY KEY version_id`, }, { clickhouse: &Clickhouse{ - Table: "schema_migrations_v1", Params: clusterParameters{ OnCluster: true, - ZooPath: "/clickhouse/tables/dev-cluster/{table}", ClusterMacro: "dev-cluster", - ReplicaMacro: "{replica}", }, }, - result: `CREATE TABLE IF NOT EXISTS schema_migrations_v1 ON CLUSTER 'dev-cluster' ( + result: `CREATE TABLE IF NOT EXISTS schema_migrations ON CLUSTER 'dev-cluster' ( version_id Int64, is_applied UInt8, date Date default now(), - tstamp DateTime('UTC') default now() + tstamp DateTime64(9, 'UTC') default now64(9, 'UTC') ) - ENGINE = ReplicatedMergeTree('/clickhouse/tables/dev-cluster/{table}', '{replica}') - ORDER BY (date)`, + ENGINE = KeeperMap('/goose_version_repl') + PRIMARY KEY version_id`, }, } for _, test := range tests { - out := test.clickhouse.CreateTable() + out := test.clickhouse.CreateTable("schema_migrations") if diff := cmp.Diff(test.result, out); diff != "" { t.Errorf("clickhouse.CreateTable() mismatch (-want +got):\n%s", diff) } @@ -82,39 +76,19 @@ func TestClickhouseAttachOptions(t *testing.T) { err: nil, expected: clusterParameters{ OnCluster: true, - ZooPath: "/clickhouse/tables/{cluster}/{table}", ClusterMacro: "{cluster}", - ReplicaMacro: "{replica}", - }, - }, - { - options: map[string]string{ - "ON_CLUSTER": "true", - "ZOO_PATH": "/clickhouse/hard_coded_path", - }, - input: &Clickhouse{}, - err: nil, - expected: clusterParameters{ - OnCluster: true, - ZooPath: "/clickhouse/hard_coded_path", - ClusterMacro: "{cluster}", - ReplicaMacro: "{replica}", }, }, { options: map[string]string{ "ON_CLUSTER": "true", - "ZOO_PATH": "/clickhouse/hard_coded_path", "CLUSTER_MACRO": "dev-cluster", - "REPLICA_MACRO": "replica-01", }, input: &Clickhouse{}, err: nil, expected: clusterParameters{ OnCluster: true, - ZooPath: "/clickhouse/hard_coded_path", ClusterMacro: "dev-cluster", - ReplicaMacro: "replica-01", }, }, { diff --git a/migration_sql.go b/migration_sql.go index f74b70d75..6254a57b8 100644 --- a/migration_sql.go +++ b/migration_sql.go @@ -94,6 +94,7 @@ const ( resetColor = "\033[00m" ) +// TODO: verbose is not thread safe and will report a race error if you use it via parallel tests func verboseInfo(s string, args ...interface{}) { if verbose { if noColor { diff --git a/tests/clickhouse/clickhouse-replicated.xml b/tests/clickhouse/clickhouse-replicated.xml index 7352ac53a..e69abd3e0 100644 --- a/tests/clickhouse/clickhouse-replicated.xml +++ b/tests/clickhouse/clickhouse-replicated.xml @@ -8,6 +8,7 @@ cluster-0-0 + /keeper_map_tables diff --git a/tests/clickhouse/clickhouse_test.go b/tests/clickhouse/clickhouse_test.go index 32f129a2a..4fc0f970a 100644 --- a/tests/clickhouse/clickhouse_test.go +++ b/tests/clickhouse/clickhouse_test.go @@ -2,6 +2,7 @@ package clickhouse_test import ( "context" + "database/sql" "fmt" "log" "os" @@ -23,14 +24,46 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } +func openClickHouse(t *testing.T) *sql.DB { + t.Helper() + + workingDir, err := os.Getwd() + require.NoError(t, err) + ctx := context.Background() + // Minimal additional configuration (config.d) to enable cluster mode + replconf := path.Join(workingDir, "clickhouse-replicated.xml") + chContainer, err := testdb.CreateClickHouseContainer(ctx, replconf) + require.NoError(t, err) + + t.Cleanup(func() { + if err := chContainer.Terminate(ctx); err != nil { + t.Fatalf("failed to terminate container: %s", err) + } + // Reset the DB to default state - for some reason clearing up just the options doesn't work + if err := goose.SetDialect("clickhouse"); err != nil { + t.Fatalf("failed to set dialect: %s", err) + } + }) + + port, err := chContainer.MappedPort(ctx, "9000/tcp") + require.NoError(t, err) + host, err := chContainer.Host(ctx) + require.NoError(t, err) + endpoint := fmt.Sprintf("clickhouse://%s:%s", host, port.Port()) + t.Log(endpoint) + + db, err := testdb.OpenClickhouse(endpoint, true) + require.NoError(t, err) + + return db +} + func TestClickUpDownAll(t *testing.T) { t.Parallel() migrationDir := filepath.Join("testdata", "migrations") - db, cleanup, err := testdb.NewClickHouse() - check.NoError(t, err) - t.Cleanup(cleanup) + db := openClickHouse(t) /* This test applies all up migrations, asserts we have all the entries in the versions table, applies all down migration and asserts we have zero @@ -77,11 +110,9 @@ func TestClickHouseFirstThree(t *testing.T) { t.Parallel() migrationDir := filepath.Join("testdata", "migrations") - db, cleanup, err := testdb.NewClickHouse() - check.NoError(t, err) - t.Cleanup(cleanup) + db := openClickHouse(t) - err = goose.Up(db, migrationDir) + err := goose.Up(db, migrationDir) check.NoError(t, err) currentVersion, err := goose.GetDBVersion(db) @@ -135,41 +166,8 @@ func TestClickHouseOnCluster(t *testing.T) { "ON_CLUSTER": "true", }) require.NoError(t, err) - ctx := context.Background() - - workingDir, err := os.Getwd() - require.NoError(t, err) - - // Minimal additional configuration (config.d) to enable cluster mode - replconf := path.Join(workingDir, "clickhouse-replicated.xml") - chContainer, err := testdb.CreateClickHouseContainer(ctx, replconf) - require.NoError(t, err) - - t.Cleanup(func() { - if err := chContainer.Terminate(ctx); err != nil { - t.Fatalf("failed to terminate container: %s", err) - } - // Reset the DB to default state - for some reason clearing up just the options doesn't work - if err := goose.SetDialect("clickhouse"); err != nil { - t.Fatalf("failed to set dialect: %s", err) - } - err := goose.AttachOptions(map[string]string{ - "ON_CLUSTER": "", - }) - if err != nil { - t.Fatalf("failed to clean up dialet: %s", err) - } - }) - - port, err := chContainer.MappedPort(ctx, "9000/tcp") - require.NoError(t, err) - host, err := chContainer.Host(ctx) - require.NoError(t, err) - endpoint := fmt.Sprintf("clickhouse://%s:%s", host, port.Port()) - t.Log(endpoint) - db, err := testdb.OpenClickhouse(endpoint, true) - require.NoError(t, err) + db := openClickHouse(t) _, err = goose.GetDBVersion(db) require.NoError(t, err) @@ -213,11 +211,9 @@ func TestRemoteImportMigration(t *testing.T) { // and craft a long INSERT statement. migrationDir := filepath.Join("testdata", "migrations-remote") - db, cleanup, err := testdb.NewClickHouse() - check.NoError(t, err) - t.Cleanup(cleanup) + db := openClickHouse(t) - err = goose.Up(db, migrationDir) + err := goose.Up(db, migrationDir) check.NoError(t, err) _, err = goose.GetDBVersion(db) check.NoError(t, err) From 51168fddcf9ae276a1a8034285e2b879f94f1719 Mon Sep 17 00:00:00 2001 From: Arun Sori Date: Tue, 16 May 2023 12:10:44 +0200 Subject: [PATCH 09/11] Add support for replicated state table in ClickHouse + Fix ListMigrations in ClickHouse --- internal/cfg/cfg.go | 18 ------------------ internal/cfg/cfg_test.go | 39 --------------------------------------- 2 files changed, 57 deletions(-) delete mode 100644 internal/cfg/cfg_test.go diff --git a/internal/cfg/cfg.go b/internal/cfg/cfg.go index b6cd3af37..d61ec358b 100644 --- a/internal/cfg/cfg.go +++ b/internal/cfg/cfg.go @@ -2,7 +2,6 @@ package cfg import ( "os" - "strings" ) var ( @@ -11,8 +10,6 @@ var ( GOOSEMIGRATIONDIR = envOr("GOOSE_MIGRATION_DIR", DefaultMigrationDir) // https://no-color.org/ GOOSENOCOLOR = envOr("NO_COLOR", "false") - - GOOSE_CLICKHOUSE_PARAMS = envOr("GOOSE_CLICKHOUSE_PARAMS", "") ) var ( @@ -31,7 +28,6 @@ func List() []EnvVar { {Name: "GOOSE_DBSTRING", Value: GOOSEDBSTRING}, {Name: "GOOSE_MIGRATION_DIR", Value: GOOSEMIGRATIONDIR}, {Name: "NO_COLOR", Value: GOOSENOCOLOR}, - {Name: "GOOSE_CLICKHOUSE_PARAMS", Value: GOOSE_CLICKHOUSE_PARAMS}, } } @@ -43,17 +39,3 @@ func envOr(key, def string) string { } return val } - -func SplitKeyValuesIntoMap(input string) map[string]string { - cutset := strings.Split(input, ",") - - options := make(map[string]string) - for _, item := range cutset { - keyAndValues := strings.Split(item, "=") - if len(keyAndValues) != 2 { - continue - } - options[keyAndValues[0]] = keyAndValues[1] - } - return options -} diff --git a/internal/cfg/cfg_test.go b/internal/cfg/cfg_test.go deleted file mode 100644 index 88080963e..000000000 --- a/internal/cfg/cfg_test.go +++ /dev/null @@ -1,39 +0,0 @@ -package cfg - -import ( - "testing" - - "github.com/google/go-cmp/cmp" -) - -func TestSplitKeyValuesIntoMap(t *testing.T) { - t.Parallel() - - type testData struct { - input string - result map[string]string - } - - tests := []testData{ - { - input: "some_key=value", - result: map[string]string{ - "some_key": "value", - }, - }, - { - input: "key1=value1,key2=value2", - result: map[string]string{ - "key1": "value1", - "key2": "value2", - }, - }, - } - - for _, test := range tests { - out := SplitKeyValuesIntoMap(test.input) - if diff := cmp.Diff(test.result, out); diff != "" { - t.Errorf("SplitKeyValuesIntoMap() mismatch (-want +got):\n%s", diff) - } - } -} From b6c510a45204bfc2b21b9345ffb48360b51f8d13 Mon Sep 17 00:00:00 2001 From: Arun Sori Date: Sat, 20 May 2023 12:05:17 +0200 Subject: [PATCH 10/11] Remove usage of testify --- go.mod | 3 --- go.sum | 5 ----- tests/clickhouse/clickhouse_test.go | 15 +++++++-------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 1147b5456..013d853de 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/jackc/pgx/v5 v5.3.1 github.com/microsoft/go-mssqldb v0.21.0 github.com/ory/dockertest/v3 v3.10.0 - github.com/stretchr/testify v1.8.2 github.com/testcontainers/testcontainers-go v0.19.0 github.com/vertica/vertica-sql-go v1.3.2 github.com/ziutek/mymysql v1.5.4 @@ -26,7 +25,6 @@ require ( github.com/containerd/containerd v1.6.19 // indirect github.com/containerd/continuity v0.3.0 // indirect github.com/cpuguy83/dockercfg v0.3.1 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/cli v23.0.6+incompatible // indirect github.com/docker/distribution v2.8.1+incompatible // indirect github.com/docker/docker v23.0.6+incompatible // indirect @@ -63,7 +61,6 @@ require ( github.com/paulmach/orb v0.9.2 // indirect github.com/pierrec/lz4/v4 v4.1.17 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/procfs v0.9.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/segmentio/asm v1.2.0 // indirect diff --git a/go.sum b/go.sum index 547a21c79..858239072 100644 --- a/go.sum +++ b/go.sum @@ -208,17 +208,12 @@ github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFR github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/testcontainers/testcontainers-go v0.19.0 h1:3bmFPuQRgVIQwxZJERyzB8AogmJW3Qzh8iDyfJbPhi8= github.com/testcontainers/testcontainers-go v0.19.0/go.mod h1:3YsSoxK0rGEUzbGD4gUVt1Nm3GJpCIq94GX+2LSf3d4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= diff --git a/tests/clickhouse/clickhouse_test.go b/tests/clickhouse/clickhouse_test.go index 4fc0f970a..e87a19f6b 100644 --- a/tests/clickhouse/clickhouse_test.go +++ b/tests/clickhouse/clickhouse_test.go @@ -14,7 +14,6 @@ import ( "github.com/pressly/goose/v3" "github.com/pressly/goose/v3/internal/check" "github.com/pressly/goose/v3/internal/testdb" - "github.com/stretchr/testify/require" ) func TestMain(m *testing.M) { @@ -28,12 +27,12 @@ func openClickHouse(t *testing.T) *sql.DB { t.Helper() workingDir, err := os.Getwd() - require.NoError(t, err) + check.NoError(t, err) ctx := context.Background() // Minimal additional configuration (config.d) to enable cluster mode replconf := path.Join(workingDir, "clickhouse-replicated.xml") chContainer, err := testdb.CreateClickHouseContainer(ctx, replconf) - require.NoError(t, err) + check.NoError(t, err) t.Cleanup(func() { if err := chContainer.Terminate(ctx); err != nil { @@ -46,14 +45,14 @@ func openClickHouse(t *testing.T) *sql.DB { }) port, err := chContainer.MappedPort(ctx, "9000/tcp") - require.NoError(t, err) + check.NoError(t, err) host, err := chContainer.Host(ctx) - require.NoError(t, err) + check.NoError(t, err) endpoint := fmt.Sprintf("clickhouse://%s:%s", host, port.Port()) t.Log(endpoint) db, err := testdb.OpenClickhouse(endpoint, true) - require.NoError(t, err) + check.NoError(t, err) return db } @@ -165,12 +164,12 @@ func TestClickHouseOnCluster(t *testing.T) { err := goose.AttachOptions(map[string]string{ "ON_CLUSTER": "true", }) - require.NoError(t, err) + check.NoError(t, err) db := openClickHouse(t) _, err = goose.GetDBVersion(db) - require.NoError(t, err) + check.NoError(t, err) migrationDir := filepath.Join("testdata", "migrations") // Collect migrations so we don't have to hard-code the currentVersion From ab7289321e197808988b73d7e1406e3699a39d12 Mon Sep 17 00:00:00 2001 From: "arun.sori" Date: Wed, 24 May 2023 13:41:16 +0200 Subject: [PATCH 11/11] Remove all dependency from testcontainers-go --- go.mod | 13 --- go.sum | 121 ---------------------------- internal/testdb/clickhouse.go | 52 ++---------- internal/testdb/testdb.go | 4 +- tests/clickhouse/clickhouse_test.go | 67 +++++---------- 5 files changed, 30 insertions(+), 227 deletions(-) diff --git a/go.mod b/go.mod index 013d853de..e1dcf9003 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/jackc/pgx/v5 v5.3.1 github.com/microsoft/go-mssqldb v0.21.0 github.com/ory/dockertest/v3 v3.10.0 - github.com/testcontainers/testcontainers-go v0.19.0 github.com/vertica/vertica-sql-go v1.3.2 github.com/ziutek/mymysql v1.5.4 modernc.org/sqlite v1.22.1 @@ -22,11 +21,8 @@ require ( github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect github.com/andybalholm/brotli v1.0.5 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/containerd/containerd v1.6.19 // indirect github.com/containerd/continuity v0.3.0 // indirect - github.com/cpuguy83/dockercfg v0.3.1 // indirect github.com/docker/cli v23.0.6+incompatible // indirect - github.com/docker/distribution v2.8.1+incompatible // indirect github.com/docker/docker v23.0.6+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect @@ -38,7 +34,6 @@ require ( github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect github.com/golang-sql/sqlexp v0.1.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.3.0 // indirect github.com/imdario/mergo v0.3.15 // indirect @@ -48,13 +43,9 @@ require ( github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/compress v1.16.5 // indirect github.com/lib/pq v1.10.9 // indirect - github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-isatty v0.0.18 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/moby/patternmatcher v0.5.0 // indirect - github.com/moby/sys/sequential v0.5.0 // indirect github.com/moby/term v0.5.0 // indirect - github.com/morikuni/aec v1.0.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc3 // indirect github.com/opencontainers/runc v1.1.7 // indirect @@ -73,13 +64,9 @@ require ( go.opentelemetry.io/otel/trace v1.15.1 // indirect golang.org/x/crypto v0.8.0 // indirect golang.org/x/mod v0.10.0 // indirect - golang.org/x/net v0.9.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect golang.org/x/tools v0.8.0 // indirect - google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad // indirect - google.golang.org/grpc v1.47.0 // indirect - google.golang.org/protobuf v1.28.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect howett.net/plist v1.0.0 // indirect diff --git a/go.sum b/go.sum index 858239072..b44bf1b30 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.1.2/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.1/go.mod h1:gLa1CL2RNE4s7M3yopJ/p0iq5DdY6Yv5ZUt9MTRZOQM= @@ -7,36 +5,20 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLC github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/AzureAD/microsoft-authentication-library-for-go v0.8.1/go.mod h1:4qFor3D/HDsvBME35Xy9rwW9DecL+M2sNw1ybjPtwA0= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ClickHouse/ch-go v0.55.0 h1:jw4Tpx887YXrkyL5DfgUome/po8MLz92nz2heOQ6RjQ= github.com/ClickHouse/ch-go v0.55.0/go.mod h1:kQT2f+yp2p+sagQA/7kS6G3ukym+GQ5KAu1kuFAFDiU= github.com/ClickHouse/clickhouse-go/v2 v2.9.1 h1:IeE2bwVvAba7Yw5ZKu98bKI4NpDmykEy6jUaQdJJCk8= github.com/ClickHouse/clickhouse-go/v2 v2.9.1/go.mod h1:teXfZNM90iQ99Jnuht+dxQXCuhDZ8nvvMoTJOFrcmcg= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/Microsoft/hcsshim v0.9.7 h1:mKNHW/Xvv1aFH87Jb6ERDzXTJTLPlmzfZ28VBFD/bfg= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM= github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/containerd/containerd v1.6.19 h1:F0qgQPrG0P2JPgwpxWxYavrVeXAG0ezUIB9Z/4FTUAU= -github.com/containerd/containerd v1.6.19/go.mod h1:HZCDMn4v/Xl2579/MvtOC2M206i+JJ6VxFWU/NetrGY= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= -github.com/cpuguy83/dockercfg v0.3.1 h1:/FpZ+JaygUR/lZP2NlFI2DVfrOEMAIKP5wWEJdoYe9E= -github.com/cpuguy83/dockercfg v0.3.1/go.mod h1:sugsbF4//dDlL/i+S+rtpIWp+5h0BHJHfjj5/jFyUJc= github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -46,7 +28,6 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/cli v23.0.6+incompatible h1:CScadyCJ2ZKUDpAMZta6vK8I+6/m60VIjGIV7Wg/Eu4= github.com/docker/cli v23.0.6+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= -github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v23.0.6+incompatible h1:aBD4np894vatVX99UTx/GyOUOK4uEcROwA3+bQhEcoU= github.com/docker/docker v23.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= @@ -61,13 +42,6 @@ github.com/elastic/go-sysinfo v1.10.1/go.mod h1:QElTrQ6akcnAVCRwdkZtoAkwuTv8UVM4 github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU= github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0= github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-faster/city v1.0.1 h1:4WAxSZ3V2Ws4QRDrscLEDcibJY8uf41H6AhXDrNDcGw= github.com/go-faster/city v1.0.1/go.mod h1:jKcUJId49qdW3L1qKHH/3wPeUstCVpVSXTM6vO3VcTw= github.com/go-faster/errors v0.6.1 h1:nNIPOBkprlKzkThvS/0YaX8Zs9KewLCOSFQS5BU06FI= @@ -82,43 +56,20 @@ github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 h1:au07oEsX2xN0kt github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0 h1:ZCD6MBpcuOVfGVqsEmY5/4FtYiKz6tSyUv9LPEDei6A= github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= -github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= @@ -152,8 +103,6 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98= github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.16 h1:yOQRA0RpS5PFz/oikGwBEqvAWhWg5ufRz4ETLjwpU1Y= @@ -161,17 +110,11 @@ github.com/microsoft/go-mssqldb v0.21.0 h1:p2rpHIL7TlSv1QrbXJUAcbyRKnIT0C9rRkH2E github.com/microsoft/go-mssqldb v0.21.0/go.mod h1:+4wZTUnz/SV6nffv+RRRB/ss8jPng5Sho2SmM1l2ts4= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= -github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= -github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= -github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= -github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc3 h1:fzg1mXZFj8YdPeNkRXMg+zb88BFV0Ys52cJydRwBkb8= @@ -192,14 +135,12 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys= github.com/segmentio/asm v1.2.0/go.mod h1:BqMnlJP91P8d+4ibuonYZw9mfnzI9HfxselHZr5aAcs= @@ -210,12 +151,9 @@ github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVs github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/testcontainers/testcontainers-go v0.19.0 h1:3bmFPuQRgVIQwxZJERyzB8AogmJW3Qzh8iDyfJbPhi8= -github.com/testcontainers/testcontainers-go v0.19.0/go.mod h1:3YsSoxK0rGEUzbGD4gUVt1Nm3GJpCIq94GX+2LSf3d4= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/vertica/vertica-sql-go v1.3.2 h1:QclPnkuozQyNl6lbrTdeuFSx2/lcSRZc1XL8zWNSjdA= github.com/vertica/vertica-sql-go v1.3.2/go.mod h1:jnn2GFuv+O2Jcjktb7zyc4Utlbu9YVqpHH/lx63+1M4= @@ -239,7 +177,6 @@ go.opentelemetry.io/otel v1.15.1 h1:3Iwq3lfRByPaws0f6bU3naAqOR1n5IeDWd9390kWHa8= go.opentelemetry.io/otel v1.15.1/go.mod h1:mHHGEHVDLal6YrKMmk9LqC4a3sF5g+fHfrttQIB1NTc= go.opentelemetry.io/otel/trace v1.15.1 h1:uXLo6iHJEzDfrNC0L0mNjItIp06SyaBQxu5t3xMlngY= go.opentelemetry.io/otel/trace v1.15.1/go.mod h1:IWdQG/5N1x7f6YUlmdLeJvH9yxtuJAfc4VW5Agv9r/8= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -248,53 +185,32 @@ golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0 golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ= golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.10.0 h1:lFO9qtOdlre5W1jxS3r/4szv2/6iXxScdzjoBMXNhYk= golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -309,17 +225,11 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -329,36 +239,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad h1:kqrS+lhvaMHCxul6sKQvKJ8nAAhlVItmZV822hYFH/U= -google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= -google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= @@ -367,7 +249,6 @@ gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHN gopkg.in/yaml.v1 v1.0.0-20140924161607-9f9df34309c0/go.mod h1:WDnlLJ4WF5VGsH/HVa3CI79GS0ol3YnhVnKP89i0kNg= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= @@ -376,8 +257,6 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0= howett.net/plist v1.0.0 h1:7CrbWYbPPO/PyNy38b2EB/+gYbjCe2DXBxgtOOZbSQM= howett.net/plist v1.0.0/go.mod h1:lqaXoTrLY4hg8tnEzNru53gicrbv7rrk+2xJA/7hw9g= diff --git a/internal/testdb/clickhouse.go b/internal/testdb/clickhouse.go index fa8de4a98..e18cf18ea 100644 --- a/internal/testdb/clickhouse.go +++ b/internal/testdb/clickhouse.go @@ -1,26 +1,24 @@ package testdb import ( - "context" "crypto/tls" "database/sql" "fmt" "log" "os" + "path" "strconv" "time" "github.com/ClickHouse/clickhouse-go/v2" "github.com/ory/dockertest/v3" "github.com/ory/dockertest/v3/docker" - "github.com/testcontainers/testcontainers-go" - "github.com/testcontainers/testcontainers-go/wait" ) const ( // https://hub.docker.com/r/clickhouse/clickhouse-server/ CLICKHOUSE_IMAGE = "clickhouse/clickhouse-server" - CLICKHOUSE_VERSION = "22.9-alpine" + CLICKHOUSE_VERSION = "23.2.6.34-alpine" CLICKHOUSE_DB = "clickdb" CLICKHOUSE_USER = "clickuser" @@ -34,7 +32,7 @@ var ( DB_HOST string ) -func newClickHouse(opts ...OptionsFunc) (*sql.DB, func(), error) { +func newClickHouse(confDir string, opts ...OptionsFunc) (*sql.DB, func(), error) { option := &options{} for _, f := range opts { f(option) @@ -44,6 +42,8 @@ func newClickHouse(opts ...OptionsFunc) (*sql.DB, func(), error) { if err != nil { return nil, nil, err } + // Minimal additional configuration (config.d) to enable cluster mode + replconf := path.Join(confDir, "clickhouse-replicated.xml") runOptions := &dockertest.RunOptions{ Repository: CLICKHOUSE_IMAGE, Tag: CLICKHOUSE_VERSION, @@ -55,6 +55,7 @@ func newClickHouse(opts ...OptionsFunc) (*sql.DB, func(), error) { }, Labels: map[string]string{"goose_test": "1"}, PortBindings: make(map[docker.Port][]docker.PortBinding), + Mounts: []string{fmt.Sprintf("%s:/etc/clickhouse-server/config.d/testconf.xml", replconf)}, } // Port 8123 is used for HTTP, but we're using the TCP protocol endpoint (port 9000). // Ref: https://clickhouse.com/docs/en/interfaces/http/ @@ -126,44 +127,3 @@ func clickHouseOpenDB(address string, tlsConfig *tls.Config, debug bool) *sql.DB db.SetConnMaxLifetime(time.Hour) return db } - -const ( - ClickHousePort = "9000/tcp" - ClickhouseHTTPPort = "8123/tcp" - clickHouseImage = "clickhouse/clickhouse-server:23.2.6.34-alpine" -) - -func CreateClickHouseContainer(ctx context.Context, configPath string) (testcontainers.Container, error) { - var mounts testcontainers.ContainerMounts - if configPath != "" { - mounts = testcontainers.Mounts(testcontainers.BindMount(configPath, "/etc/clickhouse-server/config.d/testconf.xml")) - } - chReq := testcontainers.ContainerRequest{ - Image: clickHouseImage, - ExposedPorts: []string{ClickHousePort, ClickhouseHTTPPort}, - WaitingFor: wait.ForHTTP("/").WithPort(ClickhouseHTTPPort), - Mounts: mounts, - } - return testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{ - ContainerRequest: chReq, - Started: true, - }) -} - -func OpenClickhouse(endpoint string, debug bool) (*sql.DB, error) { - opts, err := clickhouse.ParseDSN(endpoint) - if err != nil { - return nil, nil - } - - opts.Debug = debug - - opts.Settings = clickhouse.Settings{ - "max_execution_time": 60, - } - opts.DialTimeout = 5 * time.Second - opts.Compression = &clickhouse.Compression{ - Method: clickhouse.CompressionLZ4, - } - return clickhouse.OpenDB(opts), nil -} diff --git a/internal/testdb/testdb.go b/internal/testdb/testdb.go index ffa831eab..49c417b5a 100644 --- a/internal/testdb/testdb.go +++ b/internal/testdb/testdb.go @@ -3,8 +3,8 @@ package testdb import "database/sql" // NewClickHouse starts a ClickHouse docker container. Returns db connection and a docker cleanup function. -func NewClickHouse(options ...OptionsFunc) (db *sql.DB, cleanup func(), err error) { - return newClickHouse(options...) +func NewClickHouse(confDir string, options ...OptionsFunc) (db *sql.DB, cleanup func(), err error) { + return newClickHouse(confDir, options...) } // NewPostgres starts a PostgreSQL docker container. Returns db connection and a docker cleanup function. diff --git a/tests/clickhouse/clickhouse_test.go b/tests/clickhouse/clickhouse_test.go index e87a19f6b..49b1d5df1 100644 --- a/tests/clickhouse/clickhouse_test.go +++ b/tests/clickhouse/clickhouse_test.go @@ -1,12 +1,8 @@ package clickhouse_test import ( - "context" - "database/sql" - "fmt" "log" "os" - "path" "path/filepath" "testing" "time" @@ -23,46 +19,15 @@ func TestMain(m *testing.M) { os.Exit(m.Run()) } -func openClickHouse(t *testing.T) *sql.DB { - t.Helper() - - workingDir, err := os.Getwd() - check.NoError(t, err) - ctx := context.Background() - // Minimal additional configuration (config.d) to enable cluster mode - replconf := path.Join(workingDir, "clickhouse-replicated.xml") - chContainer, err := testdb.CreateClickHouseContainer(ctx, replconf) - check.NoError(t, err) - - t.Cleanup(func() { - if err := chContainer.Terminate(ctx); err != nil { - t.Fatalf("failed to terminate container: %s", err) - } - // Reset the DB to default state - for some reason clearing up just the options doesn't work - if err := goose.SetDialect("clickhouse"); err != nil { - t.Fatalf("failed to set dialect: %s", err) - } - }) - - port, err := chContainer.MappedPort(ctx, "9000/tcp") - check.NoError(t, err) - host, err := chContainer.Host(ctx) - check.NoError(t, err) - endpoint := fmt.Sprintf("clickhouse://%s:%s", host, port.Port()) - t.Log(endpoint) - - db, err := testdb.OpenClickhouse(endpoint, true) - check.NoError(t, err) - - return db -} - func TestClickUpDownAll(t *testing.T) { t.Parallel() migrationDir := filepath.Join("testdata", "migrations") - - db := openClickHouse(t) + workingDir, err := os.Getwd() + check.NoError(t, err) + db, cleanup, err := testdb.NewClickHouse(workingDir) + check.NoError(t, err) + t.Cleanup(cleanup) /* This test applies all up migrations, asserts we have all the entries in the versions table, applies all down migration and asserts we have zero @@ -109,9 +74,13 @@ func TestClickHouseFirstThree(t *testing.T) { t.Parallel() migrationDir := filepath.Join("testdata", "migrations") - db := openClickHouse(t) + workingDir, err := os.Getwd() + check.NoError(t, err) + db, cleanup, err := testdb.NewClickHouse(workingDir) + check.NoError(t, err) + t.Cleanup(cleanup) - err := goose.Up(db, migrationDir) + err = goose.Up(db, migrationDir) check.NoError(t, err) currentVersion, err := goose.GetDBVersion(db) @@ -166,7 +135,11 @@ func TestClickHouseOnCluster(t *testing.T) { }) check.NoError(t, err) - db := openClickHouse(t) + workingDir, err := os.Getwd() + check.NoError(t, err) + db, cleanup, err := testdb.NewClickHouse(workingDir) + check.NoError(t, err) + t.Cleanup(cleanup) _, err = goose.GetDBVersion(db) check.NoError(t, err) @@ -210,9 +183,13 @@ func TestRemoteImportMigration(t *testing.T) { // and craft a long INSERT statement. migrationDir := filepath.Join("testdata", "migrations-remote") - db := openClickHouse(t) + workingDir, err := os.Getwd() + check.NoError(t, err) + db, cleanup, err := testdb.NewClickHouse(workingDir) + check.NoError(t, err) + t.Cleanup(cleanup) - err := goose.Up(db, migrationDir) + err = goose.Up(db, migrationDir) check.NoError(t, err) _, err = goose.GetDBVersion(db) check.NoError(t, err)