-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scripts for managing integration tests environments (#19)
- Loading branch information
1 parent
8621f90
commit efdbea0
Showing
8 changed files
with
197 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ | |
node_modules/ | ||
/scripts | ||
/example | ||
/testbin | ||
/env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,5 @@ Dockerfile | |
.editorconfig | ||
.travis.yml | ||
/scripts | ||
/testbin | ||
/env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Param( | ||
[string] | ||
[Parameter(Position=0)] | ||
$Version = "4.6.4" | ||
) | ||
|
||
if ($Version -match "^(\d+\.)*\d+$") { | ||
$env:CBIMAGE = "couchbase:enterprise-$Version" | ||
} else { | ||
$env:CBIMAGE = $Version | ||
} | ||
|
||
docker-compose -p cbindexmgr -f $PSScriptRoot\docker-compose.yaml down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Executes couchbase-index-manager in a container with access to the test cluster | ||
# with command line parameter passthrough | ||
# Automatically includes authentication information for the test cluster | ||
# and maps the example folder to /example in the container, set as the working dir | ||
|
||
Param( | ||
[switch] | ||
$NoBuild, | ||
|
||
[string[]] | ||
[Parameter(ValueFromRemainingArguments=$true)] | ||
$Params | ||
) | ||
|
||
$effectiveParams = @( | ||
"-c", "couchbase://node1,node2,node3", | ||
"-u", "Administrator", | ||
"-p", "password" | ||
) | ||
|
||
$effectiveParams += $Params | ||
|
||
if (-not $NoBuild) { | ||
docker build -t cbindexmgr-testexec $PSScriptRoot\.. | ||
if ($LASTEXITCODE -ne 0) { | ||
exit $LASTEXITCODE | ||
} | ||
} | ||
|
||
$image = & docker inspect cbindexmgr_node1_1 -f '{{ index .Config.Labels \"com.centeredgesoftware.cbindexmgr.image\"}}' | ||
if ($LASTEXITCODE -ne 0) { | ||
exit $LASTEXITCODE | ||
} | ||
|
||
$version = [regex]::match($image,'((\d+\.){2}\d+)').Groups[1].Value | ||
if ($version) { | ||
$versionNum = New-Object System.Version $version | ||
if ($versionNum.Major -lt 5) { | ||
$effectiveParams += @("--no-rbac") | ||
} | ||
} | ||
|
||
docker run -it --network cbindexmgr -v "$PSScriptRoot\..\example:/example:ro" -w /example cbindexmgr-testexec $effectiveParams | ||
exit $LASTEXITCODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Testing Environments | ||
|
||
This folder contains Docker Compose files that help to create | ||
testing environments. | ||
|
||
## Starting the Environment | ||
|
||
```powershell | ||
./env/Up.ps1 4.6.4 | ||
``` | ||
|
||
For an image other than Enterprise from the "couchbase" registry: | ||
|
||
```powershell | ||
./env/Up.ps1 couchbase/server:5.5.0-Mar | ||
``` | ||
|
||
## Running couchbase-index-manager | ||
|
||
If another shell window: | ||
|
||
```powershell | ||
./env/Exec.ps1 sync beer-sample ./beer-sample | ||
``` | ||
|
||
## Stopping the Environment | ||
|
||
First, press CTRL+C to stop the containers, then: | ||
|
||
```powershell | ||
./env/Down.ps1 4.6.4 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Param( | ||
[string] | ||
[Parameter(Position=0)] | ||
$Version = "4.6.4" | ||
) | ||
|
||
if ($Version -match "^(\d+\.)*\d+$") { | ||
$env:CBIMAGE = "couchbase:enterprise-$Version" | ||
} else { | ||
$env:CBIMAGE = $Version | ||
} | ||
|
||
docker-compose -p cbindexmgr -f $PSScriptRoot\docker-compose.yaml up |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
version: '3.5' | ||
services: | ||
node1: | ||
image: ${CBIMAGE:-couchbase:enterprise-4.6.4} | ||
labels: | ||
com.centeredgesoftware.cbindexmgr.image: ${CBIMAGE:-couchbase:enterprise-4.6.4} | ||
ports: | ||
- "8091:8091" | ||
command: > | ||
/bin/bash -c " | ||
set -m; | ||
/entrypoint.sh couchbase-server & | ||
while true; do | ||
sleep 3; | ||
/opt/couchbase/bin/couchbase-cli node-init -c node1.cbindexmgr:8091 \ | ||
-u Administrator -p password \ | ||
--node-init-hostname=node1.cbindexmgr && | ||
sleep 1 && | ||
/opt/couchbase/bin/couchbase-cli cluster-init \ | ||
-u Administrator -p password \ | ||
--cluster-username Administrator --cluster-password password \ | ||
--cluster-ramsize 512 --cluster-index-ramsize 256 \ | ||
--services data,index,query && break | ||
done; | ||
fg 1" | ||
node2: | ||
image: ${CBIMAGE:-couchbase:enterprise-4.6.4} | ||
command: > | ||
/bin/bash -c " | ||
set -m; | ||
/entrypoint.sh couchbase-server & | ||
while true; do | ||
sleep 3; | ||
/opt/couchbase/bin/couchbase-cli node-init -c node2.cbindexmgr:8091 \ | ||
-u Administrator -p password \ | ||
--node-init-hostname=node2.cbindexmgr && break | ||
done; | ||
fg 1" | ||
node3: | ||
image: ${CBIMAGE:-couchbase:enterprise-4.6.4} | ||
command: > | ||
/bin/bash -c " | ||
set -m; | ||
/entrypoint.sh couchbase-server & | ||
while true; do | ||
sleep 3; | ||
/opt/couchbase/bin/couchbase-cli node-init -c node3.cbindexmgr:8091 \ | ||
-u Administrator -p password \ | ||
--node-init-hostname=node3.cbindexmgr && break | ||
done; | ||
fg 1" | ||
startup: | ||
image: ${CBIMAGE:-couchbase:enterprise-4.6.4} | ||
depends_on: | ||
- node1 | ||
- node2 | ||
- node3 | ||
working_dir: /opt/couchbase/bin | ||
command: > | ||
/bin/bash -c " | ||
while true; do | ||
sleep 3; | ||
./couchbase-cli server-add -c node1.cbindexmgr -u Administrator -p password \ | ||
--server-add node2.cbindexmgr \ | ||
--server-add-username Administrator --server-add-password password \ | ||
--services data,index,query && break | ||
done; | ||
while true; do | ||
sleep 3; | ||
./couchbase-cli server-add -c node1.cbindexmgr -u Administrator -p password \ | ||
--server-add node3.cbindexmgr \ | ||
--server-add-username Administrator --server-add-password password \ | ||
--services data,index,query && break | ||
done; | ||
while true; do | ||
sleep 3; | ||
./couchbase-cli rebalance -c node1.cbindexmgr \ | ||
-u Administrator -p password && break | ||
done; | ||
while true; do | ||
sleep 3; | ||
./cbdocloader -n node1.cbindexmgr -u Administrator -p password \ | ||
-b beer-sample -s 100 /opt/couchbase/samples/beer-sample.zip && break | ||
done | ||
" | ||
networks: | ||
default: | ||
name: cbindexmgr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters