Skip to content

Commit fec7119

Browse files
authored
Merge branch 'main' into lint-fix
2 parents 867e23b + 68cdb49 commit fec7119

File tree

15 files changed

+127
-67
lines changed

15 files changed

+127
-67
lines changed

.github/workflows/admin.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
cache: false
4141

4242
- name: Enable Go build cache
43-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4444
with:
4545
path: ~/.cache/go-build
4646
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
@@ -49,7 +49,7 @@ jobs:
4949
${{ runner.os }}-go-build-
5050
5151
- name: Enable Go modules cache
52-
uses: actions/cache@v3
52+
uses: actions/cache@v4
5353
with:
5454
path: ~/go/pkg/mod
5555
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}
@@ -104,7 +104,7 @@ jobs:
104104
cache: false
105105

106106
- name: Enable Go build cache
107-
uses: actions/cache@v3
107+
uses: actions/cache@v4
108108
with:
109109
path: ~/.cache/go-build
110110
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
@@ -113,7 +113,7 @@ jobs:
113113
${{ runner.os }}-go-build-
114114
115115
- name: Enable Go modules cache
116-
uses: actions/cache@v3
116+
uses: actions/cache@v4
117117
with:
118118
path: ~/go/pkg/mod
119119
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}

.github/workflows/agent.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
cache: false
7373

7474
- name: Enable Go build cache
75-
uses: actions/cache@v3
75+
uses: actions/cache@v4
7676
with:
7777
path: ~/.cache/go-build
7878
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
@@ -81,7 +81,7 @@ jobs:
8181
${{ runner.os }}-go-build-
8282
8383
- name: Enable Go modules cache
84-
uses: actions/cache@v3
84+
uses: actions/cache@v4
8585
with:
8686
path: ~/go/pkg/mod
8787
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}

.github/workflows/clean.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ jobs:
5757
lfs: true
5858

5959
- name: Enable Go modules cache
60-
uses: actions/cache@v3
60+
uses: actions/cache@v4
6161
with:
6262
path: ~/go/pkg/mod
6363
key: ${{ matrix.os }}-go-${{ matrix.go.version }}-modules-${{ hashFiles('**/go.sum') }}
6464
restore-keys: |
6565
${{ matrix.os }}-go-${{ matrix.go.version }}-modules-
6666
- name: Enable Go build cache
67-
uses: actions/cache@v3
67+
uses: actions/cache@v4
6868
with:
6969
path: ~/.cache/go-build
7070
key: ${{ matrix.os }}-go-${{ matrix.go.version }}-build-${{ github.ref }}-${{ hashFiles('**') }}

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
cache: false
2929

3030
- name: Enable Go build cache
31-
uses: actions/cache@v3
31+
uses: actions/cache@v4
3232
with:
3333
path: ~/.cache/go-build
3434
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
@@ -37,7 +37,7 @@ jobs:
3737
${{ runner.os }}-go-build-
3838
3939
- name: Enable Go modules cache
40-
uses: actions/cache@v3
40+
uses: actions/cache@v4
4141
with:
4242
path: ~/go/pkg/mod
4343
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}

.github/workflows/managed.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
- name: Enable Go build cache
4242
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
43-
uses: actions/cache@v3
43+
uses: actions/cache@v4
4444
with:
4545
path: ~/.cache/go-build
4646
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
@@ -50,7 +50,7 @@ jobs:
5050
5151
- name: Enable Go modules cache
5252
if: ${{ fromJSON(env.DEVCONTAINER_CACHE_ENABLED) }}
53-
uses: actions/cache@v3
53+
uses: actions/cache@v4
5454
with:
5555
path: ~/go/pkg/mod
5656
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}

.github/workflows/qan-api2.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
cache: false
4242

4343
- name: Enable Go build cache
44-
uses: actions/cache@v3
44+
uses: actions/cache@v4
4545
with:
4646
path: ~/.cache/go-build
4747
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
@@ -50,7 +50,7 @@ jobs:
5050
${{ runner.os }}-go-build-
5151
5252
- name: Enable Go modules cache
53-
uses: actions/cache@v3
53+
uses: actions/cache@v4
5454
with:
5555
path: ~/go/pkg/mod
5656
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}

.github/workflows/vmproxy.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
cache: false
4242

4343
- name: Enable Go build cache
44-
uses: actions/cache@v3
44+
uses: actions/cache@v4
4545
with:
4646
path: ~/.cache/go-build
4747
key: ${{ runner.os }}-go-build-${{ github.ref }}-${{ hashFiles('**') }}
@@ -50,7 +50,7 @@ jobs:
5050
${{ runner.os }}-go-build-
5151
5252
- name: Enable Go modules cache
53-
uses: actions/cache@v3
53+
uses: actions/cache@v4
5454
with:
5555
path: ~/go/pkg/mod
5656
key: ${{ runner.os }}-go-modules-${{ hashFiles('**/go.sum') }}

cli-tests/package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cli-tests/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@
3030
"eslint-config-airbnb-base": "^15.0.0",
3131
"eslint-config-airbnb-typescript": "^17.1.0",
3232
"eslint-plugin-import": "^2.29.0",
33-
"eslint-plugin-playwright": "^0.21.0"
33+
"eslint-plugin-playwright": "^0.22.1"
3434
}
3535
}

go.mod

+7-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ require (
2525
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2
2626
github.com/aws/aws-sdk-go v1.49.6
2727
github.com/blang/semver v3.5.1+incompatible
28-
github.com/brianvoe/gofakeit/v6 v6.26.0
28+
github.com/brianvoe/gofakeit/v6 v6.27.0
2929
github.com/charmbracelet/bubbles v0.17.1
3030
github.com/charmbracelet/bubbletea v0.25.0
3131
github.com/charmbracelet/lipgloss v0.9.1
@@ -112,7 +112,7 @@ require (
112112
github.com/go-ini/ini v1.67.0 // indirect
113113
github.com/go-logr/logr v1.3.0 // indirect
114114
github.com/go-logr/stdr v1.2.2 // indirect
115-
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
115+
github.com/golang-jwt/jwt/v5 v5.2.0 // indirect
116116
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
117117
github.com/google/gnostic-models v0.6.8 // indirect
118118
github.com/google/gofuzz v1.2.0 // indirect
@@ -155,11 +155,11 @@ require (
155155
)
156156

157157
require (
158-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 // indirect
159-
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0
160-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect
158+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 // indirect
159+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1
160+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 // indirect
161161
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0
162-
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect
162+
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 // indirect
163163
github.com/ClickHouse/ch-go v0.58.2 // indirect
164164
github.com/ClickHouse/clickhouse-go v1.5.4 // indirect
165165
github.com/HdrHistogram/hdrhistogram-go v1.1.2
@@ -229,7 +229,7 @@ require (
229229
github.com/opentracing/opentracing-go v1.2.0 // indirect
230230
github.com/paulmach/orb v0.10.0 // indirect
231231
github.com/pierrec/lz4/v4 v4.1.18 // indirect
232-
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
232+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
233233
github.com/prometheus/client_model v0.5.0 // indirect
234234
github.com/prometheus/common/sigv4 v0.1.0 // indirect
235235
github.com/prometheus/exporter-toolkit v0.10.0 // indirect

go.sum

+14-15
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ github.com/AlekSi/pointer v1.2.0 h1:glcy/gc4h8HnG2Z3ZECSzZ1IX1x2JxRVuDzaJwQE0+w=
3737
github.com/AlekSi/pointer v1.2.0/go.mod h1:gZGfd3dpW4vEc/UlyfKKi1roIqcCgwOIvb0tSNSBle0=
3838
github.com/Azure/azure-pipeline-go v0.2.3 h1:7U9HBg1JFK3jHl5qmo4CTZKFTVgMwdFHMVtCdfBE21U=
3939
github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k=
40-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w=
41-
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q=
42-
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI=
43-
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs=
44-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs=
45-
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI=
40+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1 h1:lGlwhPtrX6EVml1hO0ivjkUxsSyl4dsiw9qcA1k/3IQ=
41+
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.1/go.mod h1:RKUqNu35KJYcVG/fqTRqmuXJZYNhYkBrnC/hX7yGbTA=
42+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1 h1:sO0/P7g68FrryJzljemN+6GTssUXdANk6aJ7T1ZxnsQ=
43+
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.5.1/go.mod h1:h8hyGFDsU5HMivxiS2iYFZsgDbU9OnnJ163x5UGVKYo=
44+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1 h1:6oNBlSdi1QqM1PNW7FPA6xOGA5UNsXnkaYZz9vdPGhA=
45+
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.1/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI=
4646
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0 h1:zLzoX5+W2l95UJoVwiyNS4dX8vHyQ6x2xRLoBBL9wMk=
4747
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcegraph/armresourcegraph v0.9.0/go.mod h1:wVEOJfGTj0oPAUGA1JuRAvz/lxXQsWW16axmHPP47Bk=
4848
github.com/Azure/azure-storage-blob-go v0.13.0/go.mod h1:pA9kNqtjUeQF2zOSu4s//nUdBD+e64lEuc4sVnuOfNs=
@@ -64,8 +64,8 @@ github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+Z
6464
github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
6565
github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
6666
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
67-
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk=
68-
github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
67+
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1 h1:DzHpqpoJVaCgOUdVHxE8QB52S6NiVdDQvGlny1qvPqA=
68+
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI=
6969
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
7070
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
7171
github.com/ClickHouse/ch-go v0.58.2 h1:jSm2szHbT9MCAB1rJ3WuCJqmGLi5UTjlNu+f530UTS0=
@@ -141,8 +141,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
141141
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
142142
github.com/brianvoe/gofakeit v3.18.0+incompatible h1:wDOmHc9DLG4nRjUVVaxA+CEglKOW72Y5+4WNxUIkjM8=
143143
github.com/brianvoe/gofakeit v3.18.0+incompatible/go.mod h1:kfwdRA90vvNhPutZWfH7WPaDzUjz+CZFqG+rPkOjGOc=
144-
github.com/brianvoe/gofakeit/v6 v6.26.0 h1:DzJHo4K6RrAbglU6cReh+XqoaunuUMZ8OAQGXrYsXt8=
145-
github.com/brianvoe/gofakeit/v6 v6.26.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs=
144+
github.com/brianvoe/gofakeit/v6 v6.27.0 h1:rI6rhEtXnMfdRHc1pE1tdXN/LRnDlRzFZXL2ArDV3Wk=
145+
github.com/brianvoe/gofakeit/v6 v6.27.0/go.mod h1:Xj58BMSnFqcn/fAQeSK+/PLtC5kSb7FJIq4JyGa8vEs=
146146
github.com/cenkalti/backoff/v4 v4.2.1 h1:y4OZtCnogmCPw98Zjyt5a6+QwPLGkiQsYW5oUqylYbM=
147147
github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
148148
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
@@ -324,8 +324,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
324324
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
325325
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
326326
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
327-
github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE=
328-
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
327+
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
328+
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
329329
github.com/golang-migrate/migrate/v4 v4.17.0 h1:rd40H3QXU0AA4IoLllFcEAEo9dYKRHYND2gB4p7xcaU=
330330
github.com/golang-migrate/migrate/v4 v4.17.0/go.mod h1:+Cp2mtLP4/aXDTKb9wmXYitdrNx2HGs45rbWAo6OsKM=
331331
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
@@ -677,8 +677,8 @@ github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9F
677677
github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
678678
github.com/pierrec/lz4/v4 v4.1.18 h1:xaKrnTkyoqfh1YItXl56+6KJNVYWlEEPuAQW9xsplYQ=
679679
github.com/pierrec/lz4/v4 v4.1.18/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
680-
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
681-
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
680+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
681+
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
682682
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
683683
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
684684
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -998,7 +998,6 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
998998
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
999999
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10001000
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
1001-
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10021001
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10031002
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
10041003
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

managed/models/agent_model.go

+37-22
Original file line numberDiff line numberDiff line change
@@ -492,17 +492,15 @@ func (s *Agent) DSN(service *Service, dsnParams DSNParams, tdp *DelimiterPair) s
492492
}
493493
q.Set("sslmode", sslmode)
494494

495-
if s.PostgreSQLOptions != nil {
496-
if files := s.Files(); len(files) != 0 {
497-
for key := range files {
498-
switch key {
499-
case caFilePlaceholder:
500-
q.Add("sslrootcert", tdp.Left+".TextFiles."+caFilePlaceholder+tdp.Right)
501-
case certificateFilePlaceholder:
502-
q.Add("sslcert", tdp.Left+".TextFiles."+certificateFilePlaceholder+tdp.Right)
503-
case certificateKeyFilePlaceholder:
504-
q.Add("sslkey", tdp.Left+".TextFiles."+certificateKeyFilePlaceholder+tdp.Right)
505-
}
495+
if files := s.Files(); len(files) != 0 {
496+
for key := range files {
497+
switch key {
498+
case caFilePlaceholder:
499+
q.Add("sslrootcert", tdp.Left+".TextFiles."+caFilePlaceholder+tdp.Right)
500+
case certificateFilePlaceholder:
501+
q.Add("sslcert", tdp.Left+".TextFiles."+certificateFilePlaceholder+tdp.Right)
502+
case certificateKeyFilePlaceholder:
503+
q.Add("sslkey", tdp.Left+".TextFiles."+certificateKeyFilePlaceholder+tdp.Right)
506504
}
507505
}
508506
}
@@ -609,30 +607,47 @@ func (s Agent) Files() map[string]string {
609607
switch s.AgentType {
610608
case MySQLdExporterType, QANMySQLPerfSchemaAgentType, QANMySQLSlowlogAgentType:
611609
if s.MySQLOptions != nil {
612-
return map[string]string{
613-
"tlsCa": s.MySQLOptions.TLSCa,
614-
"tlsCert": s.MySQLOptions.TLSCert,
615-
"tlsKey": s.MySQLOptions.TLSKey,
610+
files := make(map[string]string)
611+
if s.MySQLOptions.TLSCa != "" {
612+
files["tlsCa"] = s.MySQLOptions.TLSCa
613+
}
614+
if s.MySQLOptions.TLSCert != "" {
615+
files["tlsCert"] = s.MySQLOptions.TLSCert
616+
}
617+
if s.MySQLOptions.TLSKey != "" {
618+
files["tlsKey"] = s.MySQLOptions.TLSKey
616619
}
620+
return files
617621
}
618622
return nil
619623
case ProxySQLExporterType:
620624
return nil
621625
case QANMongoDBProfilerAgentType, MongoDBExporterType:
622626
if s.MongoDBOptions != nil {
623-
return map[string]string{
624-
caFilePlaceholder: s.MongoDBOptions.TLSCa,
625-
certificateKeyFilePlaceholder: s.MongoDBOptions.TLSCertificateKey,
627+
files := make(map[string]string)
628+
if s.MongoDBOptions.TLSCa != "" {
629+
files[caFilePlaceholder] = s.MongoDBOptions.TLSCa
626630
}
631+
if s.MongoDBOptions.TLSCertificateKey != "" {
632+
files[certificateKeyFilePlaceholder] = s.MongoDBOptions.TLSCertificateKey
633+
}
634+
return files
627635
}
628636
return nil
629637
case PostgresExporterType, QANPostgreSQLPgStatementsAgentType, QANPostgreSQLPgStatMonitorAgentType:
630638
if s.PostgreSQLOptions != nil {
631-
return map[string]string{
632-
caFilePlaceholder: s.PostgreSQLOptions.SSLCa,
633-
certificateFilePlaceholder: s.PostgreSQLOptions.SSLCert,
634-
certificateKeyFilePlaceholder: s.PostgreSQLOptions.SSLKey,
639+
files := make(map[string]string)
640+
641+
if s.PostgreSQLOptions.SSLCa != "" {
642+
files[caFilePlaceholder] = s.PostgreSQLOptions.SSLCa
643+
}
644+
if s.PostgreSQLOptions.SSLCert != "" {
645+
files[certificateFilePlaceholder] = s.PostgreSQLOptions.SSLCert
646+
}
647+
if s.PostgreSQLOptions.SSLKey != "" {
648+
files[certificateKeyFilePlaceholder] = s.PostgreSQLOptions.SSLKey
635649
}
650+
return files
636651
}
637652
return nil
638653
default:

managed/models/agent_model_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,12 @@ func TestPostgresAgentTLS(t *testing.T) {
257257
agent.TLSSkipVerify = testCase.tlsSkipVerify
258258
assert.Equal(t, testCase.expected, agent.DSN(service, models.DSNParams{DialTimeout: time.Second, Database: "database"}, nil))
259259
})
260+
t.Run(fmt.Sprintf("AutodiscoveryLimit set TLS:%v/TLSSkipVerify:%v", testCase.tls, testCase.tlsSkipVerify), func(t *testing.T) {
261+
agent.TLS = testCase.tls
262+
agent.TLSSkipVerify = testCase.tlsSkipVerify
263+
agent.PostgreSQLOptions = &models.PostgreSQLOptions{AutoDiscoveryLimit: 10}
264+
assert.Equal(t, testCase.expected, agent.DSN(service, models.DSNParams{DialTimeout: time.Second, Database: "database"}, nil))
265+
})
260266
}
261267
}
262268

0 commit comments

Comments
 (0)