Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

add couchbase module #876

Merged
merged 32 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
754c792
create couchbase module
alihanyalcin Feb 17, 2023
46ef6c7
expose enabled service ports
alihanyalcin Feb 17, 2023
5b355b5
add wait until all nodes are healthy
alihanyalcin Feb 17, 2023
953572f
add cluster initialization functions
alihanyalcin Feb 21, 2023
a6b2493
refactor enabledServices for loop with contains method
alihanyalcin Feb 21, 2023
9263849
add configureExternalPorts
alihanyalcin Feb 21, 2023
d5b4f15
refactor doHttpRequest to create new request with context
alihanyalcin Feb 21, 2023
0e43367
add create buckets
alihanyalcin Feb 21, 2023
c8b3714
complete create bucket flow
alihanyalcin Feb 22, 2023
b78012c
add docker image name to config
alihanyalcin Feb 22, 2023
becc912
fix port suffix, mapped port, enabled services and refactor checkAllS…
alihanyalcin Feb 24, 2023
ca30255
add initCluster method
alihanyalcin Feb 24, 2023
8744d2e
refactor bucket definition
alihanyalcin Feb 24, 2023
ea85e52
update module name
alihanyalcin Feb 24, 2023
c1d0914
add ConnectionString, Username, Password for test case and fix config…
alihanyalcin Feb 25, 2023
4badc7b
add test
alihanyalcin Feb 25, 2023
04443f1
goimports and go mod tidy
alihanyalcin Feb 25, 2023
88e6811
fix: use modules instead of example
mdelapenya Feb 27, 2023
9272120
Merge remote-tracking branch 'upstream/main'
alihanyalcin Feb 28, 2023
d42ed48
change WithBasicCredentials with WithBasicAuth
alihanyalcin Feb 28, 2023
a921729
add test for community edition
alihanyalcin Feb 28, 2023
b85dd3d
Merge remote-tracking branch 'upstream/main'
alihanyalcin Mar 2, 2023
effbe26
fix eventing service with community container test
alihanyalcin Mar 2, 2023
5b59b51
update depandabot.yml and go.mod
alihanyalcin Mar 2, 2023
2ed206a
update couchbase doc
alihanyalcin Mar 2, 2023
23b17e0
reorder modules couchbase dependabot.yml
alihanyalcin Mar 3, 2023
d86893a
Update modules/couchbase/go.mod
alihanyalcin Mar 7, 2023
e784d0b
add comments for public methods
alihanyalcin Mar 7, 2023
c11b7a1
Merge remote-tracking branch 'upstream/main'
alihanyalcin Mar 7, 2023
c596691
add option for index storage mode
alihanyalcin Mar 8, 2023
7b65ad0
add comments for index storage modes
alihanyalcin Mar 9, 2023
abef3b2
Merge remote-tracking branch 'upstream/main'
alihanyalcin Mar 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 18 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ updates:
interval: weekly
open-pull-requests-limit: 3
rebase-strategy: disabled
mdelapenya marked this conversation as resolved.
Show resolved Hide resolved
- package-ecosystem: gomod
directory: /modules/compose
schedule:
interval: weekly
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/localstack
schedule:
interval: weekly
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /examples/bigtable
schedule:
Expand Down Expand Up @@ -108,3 +96,21 @@ updates:
interval: weekly
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modulegen
schedule:
interval: weekly
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/couchbase
schedule:
interval: weekly
open-pull-requests-limit: 3
rebase-strategy: disabled
- package-ecosystem: gomod
directory: /modules/localstack
schedule:
interval: weekly
open-pull-requests-limit: 3
rebase-strategy: disabled
46 changes: 46 additions & 0 deletions .github/workflows/module-couchbase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Couchbase module pipeline

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
test-couchbase:
strategy:
matrix:
go-version: [1.18.x, 1.x]
runs-on: "ubuntu-latest"
steps:

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: modVerify
working-directory: ./modules/couchbase
run: go mod verify

- name: modTidy
working-directory: ./modules/couchbase
run: make tools-tidy

- name: gotestsum
working-directory: ./modules/couchbase
run: make test-unit

- name: Run checker
run: |
./scripts/check_environment.sh

- name: Test Summary
uses: test-summary/action@4ee9ece4bca777a38f05c8fc578ac2007fe266f7
with:
paths: "**/TEST-couchbase*.xml"
if: always()
9 changes: 9 additions & 0 deletions docs/modules/couchbase.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Couchbase

<!--codeinclude-->
[Creating a Couchbase container](../../modules/couchbase/couchbase.go)
<!--/codeinclude-->

<!--codeinclude-->
[Test for a Couchbase container](../../modules/couchbase/couchbase_test.go)
<!--/codeinclude-->
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ nav:
- SQL: features/wait/sql.md
- Modules:
- modules/index.md
- modules/couchbase.md
- modules/localstack.md
- Examples:
- examples/index.md
Expand Down
5 changes: 5 additions & 0 deletions modules/couchbase/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include ../../commons-test.mk

.PHONY: test
test:
$(MAKE) test-couchbase
49 changes: 49 additions & 0 deletions modules/couchbase/bucket.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package couchbase

type bucket struct {
name string
flushEnabled bool
queryPrimaryIndex bool
quota int
numReplicas int
}

func NewBucket(name string) bucket {
return bucket{
name: name,
flushEnabled: false,
queryPrimaryIndex: true,
quota: 100,
numReplicas: 0,
}
}

func (b bucket) WithReplicas(numReplicas int) bucket {
if numReplicas < 0 {
numReplicas = 0
} else if numReplicas > 3 {
numReplicas = 3
}

b.numReplicas = numReplicas
return b
}

func (b bucket) WithFlushEnabled(flushEnabled bool) bucket {
b.flushEnabled = flushEnabled
return b
}

func (b bucket) WithQuota(quota int) bucket {
if quota < 100 {
quota = 100
}

b.quota = quota
return b
}

func (b bucket) WithPrimaryIndex(primaryIndex bool) bucket {
b.queryPrimaryIndex = primaryIndex
return b
}