Skip to content

Commit c68b6e8

Browse files
committed
Merge remote-tracking branch 'origin/main' into CBG-5144-prep-test
2 parents 696874e + 8492d56 commit c68b6e8

File tree

77 files changed

+1502
-516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1502
-516
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@ concurrency:
3131
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
3232
cancel-in-progress: ${{ !contains(github.ref, 'release/') && !contains(github.ref, 'main') }}
3333

34+
env:
35+
GO_VERSION: &go_version 1.25.7
36+
GO_TEST_ANNOTATIONS_VERSION: &go_test_annotations_version guyarb/golang-test-annotations@v0.8.0
37+
3438
jobs:
3539
build:
3640
runs-on: ubuntu-latest
3741
steps:
3842
- uses: actions/checkout@v5
3943
- uses: actions/setup-go@v5
4044
with:
41-
go-version: 1.25.6
45+
go-version: *go_version
4246
- name: go-build
4347
run: go build "./..."
4448

@@ -49,7 +53,7 @@ jobs:
4953
- uses: actions/checkout@v5
5054
- uses: actions/setup-go@v5
5155
with:
52-
go-version: 1.25.6
56+
go-version: *go_version
5357
- run: go install github.com/google/addlicense@latest
5458
- run: addlicense -check -f licenses/addlicense.tmpl .
5559

@@ -60,7 +64,7 @@ jobs:
6064
- uses: actions/checkout@v5
6165
- uses: actions/setup-go@v5
6266
with:
63-
go-version: 1.25.6
67+
go-version: *go_version
6468
- name: golangci-lint
6569
uses: golangci/golangci-lint-action@v9
6670
with:
@@ -87,15 +91,15 @@ jobs:
8791
- uses: actions/checkout@v5
8892
- uses: actions/setup-go@v5
8993
with:
90-
go-version: 1.25.6
94+
go-version: *go_version
9195
- name: Build
9296
run: go build -v "./..."
9397
- name: Run Tests
9498
run: go test -tags cb_sg_devmode -shuffle=on -timeout=30m -count=1 -json -v "./..." | tee test.json | jq -s -jr 'sort_by(.Package,.Time) | .[].Output | select (. != null )'
9599
shell: bash
96100
- name: Annotate Failures
97101
if: always()
98-
uses: guyarb/golang-test-annotations@v0.8.0
102+
uses: *go_test_annotations_version
99103
with:
100104
test-results: test.json
101105

@@ -107,13 +111,13 @@ jobs:
107111
- uses: actions/checkout@v5
108112
- uses: actions/setup-go@v5
109113
with:
110-
go-version: 1.25.6
114+
go-version: *go_version
111115
- name: Run Tests
112116
run: go test -tags cb_sg_devmode -race -shuffle=on -timeout=30m -count=1 -json -v "./..." | tee test.json | jq -s -jr 'sort_by(.Package,.Time) | .[].Output | select (. != null )'
113117
shell: bash
114118
- name: Annotate Failures
115119
if: always()
116-
uses: guyarb/golang-test-annotations@v0.8.0
120+
uses: *go_test_annotations_version
117121
with:
118122
test-results: test.json
119123

@@ -122,6 +126,43 @@ jobs:
122126
env:
123127
GOPRIVATE: github.com/couchbaselabs
124128
SG_TEST_USE_DEFAULT_COLLECTION: true
129+
steps:
130+
- uses: actions/checkout@v5
131+
- uses: actions/setup-go@v5
132+
with:
133+
go-version: *go_version
134+
- name: Run Tests
135+
run: go test -tags cb_sg_devmode -shuffle=on -timeout=30m -count=1 -json -v "./..." | tee test.json | jq -s -jr 'sort_by(.Package,.Time) | .[].Output | select (. != null )'
136+
shell: bash
137+
- name: Annotate Failures
138+
if: always()
139+
uses: *go_test_annotations_version
140+
with:
141+
test-results: test.json
142+
test-benchmark-compile:
143+
runs-on: ubuntu-latest
144+
env:
145+
GOPRIVATE: github.com/couchbaselabs
146+
steps:
147+
- uses: actions/checkout@v5
148+
- uses: actions/setup-go@v5
149+
with:
150+
go-version: *go_version
151+
- name: Run Tests
152+
run: go test -tags cb_sg_devmode -shuffle=on -timeout=30m -count=1 -json -short -bench=. -benchtime=1x -run '!' -v "./..." | tee test.json | jq -s -jr 'sort_by(.Package,.Time) | .[].Output | select (. != null )'
153+
shell: bash
154+
- name: Annotate Failures
155+
if: always()
156+
uses: *go_test_annotations_version
157+
with:
158+
test-results: test.json
159+
160+
161+
test-disable-rev-cache:
162+
runs-on: ubuntu-latest
163+
env:
164+
GOPRIVATE: github.com/couchbaselabs
165+
SG_TEST_DISABLE_REV_CACHE: true
125166
steps:
126167
- uses: actions/checkout@v5
127168
- uses: actions/setup-go@v5
@@ -174,7 +215,7 @@ jobs:
174215
- uses: actions/checkout@v5
175216
- uses: actions/setup-go@v5
176217
with:
177-
go-version: 1.25.6
218+
go-version: *go_version
178219
- name: Build
179220
run: go build -v "./tools/stats-definition-exporter"
180221
- name: Run Tests
@@ -187,7 +228,7 @@ jobs:
187228
- uses: actions/checkout@v5
188229
- uses: actions/setup-go@v5
189230
with:
190-
go-version: 1.25.6
231+
go-version: *go_version
191232
- name: Build
192233
run: go build "./tools/cache_perf_tool"
193234
govulncheck:
@@ -197,5 +238,5 @@ jobs:
197238
- id: govulncheck
198239
uses: golang/govulncheck-action@v1
199240
with:
200-
go-version-input: 1.25.6
241+
go-version-input: *go_version
201242
go-package: ./...

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pipeline {
1515
}
1616

1717
tools {
18-
go '1.25.6'
18+
go '1.25.7'
1919
}
2020

2121
stages {

auth/jwt.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var SupportedAlgorithms = map[jose.SignatureAlgorithm]bool{
3939
jose.PS256: true,
4040
jose.PS384: true,
4141
jose.PS512: true,
42+
jose.EdDSA: true,
4243
}
4344

4445
// Full list of supported algorithms is used to initially parse the JWT. The more restricted list (based
@@ -53,6 +54,7 @@ var SupportedAlgorithmsSlice = []jose.SignatureAlgorithm{
5354
jose.PS256,
5455
jose.PS384,
5556
jose.PS512,
57+
jose.EdDSA,
5658
}
5759

5860
// JWTConfigCommon groups together configuration options common to both OIDC and local JWT authentication.

base/collection_xattr_common.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (c *Collection) WriteTombstoneWithXattrs(ctx context.Context, k string, exp
8888

8989
// If deleteBody == true, remove the body and update xattr
9090
if deleteBody {
91-
casOut, tombstoneErr = c.updateXattrsDeleteBody(ctx, k, exp, cas, xattrs, nil, opts)
91+
casOut, tombstoneErr = c.updateXattrsDeleteBody(ctx, k, exp, cas, xattrs, xattrsToDelete, opts)
9292
} else {
9393
if len(xattrs) == 0 && len(xattrsToDelete) == 0 {
9494
return false, sgbucket.ErrNeedXattrs, 0

base/collection_xattr_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ func TestWriteTombstoneWithXattrs(t *testing.T) {
798798
finalXattrs: map[string][]byte{
799799
"_xattr1": []byte(`{"c": "d"}`),
800800
},
801+
writeErrorFunc: RequireXattrDeleteOnDocumentInsertError,
801802
},
802803
{
803804
name: "previousDoc=nil,xattrsToUpdate=_xattr1,xattrsToDelete=_xattr2,cas=0,deleteBody=true",
@@ -811,14 +812,15 @@ func TestWriteTombstoneWithXattrs(t *testing.T) {
811812
"_xattr1": []byte(`{"c": "d"}`),
812813
},
813814
deleteBody: true,
814-
writeErrorFunc: RequireDocNotFoundError,
815+
writeErrorFunc: RequireXattrDeleteOnDocumentInsertError,
815816
},
816817
{
817818
name: "previousDoc=body+_xattr1,_xattr2,xattrsToUpdate=_xattr1,xattrsToDelete=_xattr2,cas=correct,deleteBody=false",
818819
previousDoc: &sgbucket.BucketDocument{
819820
Body: []byte(`{"foo": "bar"}`),
820821
Xattrs: map[string][]byte{
821822
"_xattr1": []byte(`{"a" : "b"}`),
823+
"_xattr2": []byte(`{"c": "d"}`),
822824
},
823825
},
824826
updatedXattrs: map[string][]byte{
@@ -838,6 +840,7 @@ func TestWriteTombstoneWithXattrs(t *testing.T) {
838840
Body: []byte(`{"foo": "bar"}`),
839841
Xattrs: map[string][]byte{
840842
"_xattr1": []byte(`{"a" : "b"}`),
843+
"_xattr2": []byte(`{"c": "d"}`),
841844
},
842845
},
843846
updatedXattrs: map[string][]byte{
@@ -874,7 +877,7 @@ func TestWriteTombstoneWithXattrs(t *testing.T) {
874877
cas = casOut
875878
}
876879
}
877-
_, err := col.WriteTombstoneWithXattrs(ctx, docID, exp, cas, test.updatedXattrs, nil, test.deleteBody, nil)
880+
_, err := col.WriteTombstoneWithXattrs(ctx, docID, exp, cas, test.updatedXattrs, test.xattrsToDelete, test.deleteBody, nil)
878881
if test.writeErrorFunc != nil {
879882
test.writeErrorFunc(t, err)
880883
if test.finalBody != nil {

base/constants.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ const (
4747
TestEnvSyncGatewayUseXattrs = "SG_TEST_USE_XATTRS"
4848
TestEnvSyncGatewayTrue = "True"
4949

50+
// TestEnvDisableRevCache if set to true will disable the revision cache for tests
51+
TestEnvDisableRevCache = "SG_TEST_DISABLE_REV_CACHE"
52+
5053
// Should the tests drop the GSI indexes?
5154
TestEnvSyncGatewayDropIndexes = "SG_TEST_DROP_INDEXES"
5255

0 commit comments

Comments
 (0)