Skip to content
This repository has been archived by the owner on Feb 7, 2023. It is now read-only.

Commit

Permalink
Merge pull request #381 from Jakeeyturner/update-container-name
Browse files Browse the repository at this point in the history
Start with 'microfab' in name
  • Loading branch information
mergify[bot] authored Dec 15, 2020
2 parents 32ae3a3 + e3c0f5d commit 2b8f461
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion generators/network/templates/is_running.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rem
rem SPDX-License-Identifier: Apache-2.0
rem

for /f "usebackq tokens=*" %%i in (`docker ps -f label^=fabric-environment-name^="<%= name %>" -q`) do set container=%%i
for /f "usebackq tokens=*" %%i in (`docker ps -f label^=fabric-environment-name^="<%= name %> Microfab" -q`) do set container=%%i

if not defined container (
exit /b 1
Expand Down
2 changes: 1 addition & 1 deletion generators/network/templates/is_running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Exit on first error, print all commands.
set +ev
NUM_CONTAINERS=$(docker container port $(docker ps -f label=fabric-environment-name="<%= name %>" -q) | grep <%-port%>/tcp | wc -l | tr -d ' ')
NUM_CONTAINERS=$(docker container port $(docker ps -f label=fabric-environment-name="<%= name %> Microfab" -q) | grep <%-port%>/tcp | wc -l | tr -d ' ')
if [ "${NUM_CONTAINERS}" -eq 0 ]; then
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions generators/network/templates/start.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rem
setlocal enabledelayedexpansion


FOR /F "usebackq tokens=*" %%g IN (`docker ps -f label^=fabric-environment-name^="<%= name %>" -q -a`) do (SET CONTAINER=%%g)
FOR /F "usebackq tokens=*" %%g IN (`docker ps -f label^=fabric-environment-name^="<%= name %> Microfab" -q -a`) do (SET CONTAINER=%%g)

IF DEFINED CONTAINER (
docker start %CONTAINER%
Expand All @@ -16,7 +16,7 @@ IF DEFINED CONTAINER (
)
) ELSE (
SET MICROFAB_CONFIG=<%-microfabConfig%>
docker run -e MICROFAB_CONFIG --label fabric-environment-name="<%= name %>" -d -p <%-port%>:<%-port%> ibmcom/ibp-microfab:0.0.7
docker run -e MICROFAB_CONFIG --label fabric-environment-name="<%= name %> Microfab" -d -p <%-port%>:<%-port%> ibmcom/ibp-microfab:0.0.7
)


Expand Down
4 changes: 2 additions & 2 deletions generators/network/templates/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#
# Exit on first error, print all commands.
set -ev
CONTAINER=$(docker ps -f label=fabric-environment-name="<%= name %>" -q -a)
CONTAINER=$(docker ps -f label=fabric-environment-name="<%= name %> Microfab" -q -a)
if [ -z "$CONTAINER" ]
then
export MICROFAB_CONFIG='<%-microfabConfig%>'
docker run -e MICROFAB_CONFIG --label fabric-environment-name="<%= name %>" -d -p <%-port%>:<%-port%> ibmcom/ibp-microfab:0.0.7
docker run -e MICROFAB_CONFIG --label fabric-environment-name="<%= name %> Microfab" -d -p <%-port%>:<%-port%> ibmcom/ibp-microfab:0.0.7
else
docker start ${CONTAINER}
fi
Expand Down
2 changes: 1 addition & 1 deletion generators/network/templates/stop.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rem
rem SPDX-License-Identifier: Apache-2.0
rem
setlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%c in (`docker ps -f label^=fabric-environment-name^="<%= name %>" -q`) do (
for /f "usebackq tokens=*" %%c in (`docker ps -f label^=fabric-environment-name^="<%= name %> Microfab" -q`) do (
docker stop %%c
if !errorlevel! neq 0 (
exit /b !errorlevel!
Expand Down
2 changes: 1 addition & 1 deletion generators/network/templates/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Exit on first error, print all commands.
set -ev
for CONTAINER in $(docker ps -f label=fabric-environment-name="<%= name %>" -q); do
for CONTAINER in $(docker ps -f label=fabric-environment-name="<%= name %> Microfab" -q); do
docker stop ${CONTAINER}
done
sleep 2
Expand Down
4 changes: 2 additions & 2 deletions generators/network/templates/teardown.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ rem
rem SPDX-License-Identifier: Apache-2.0
rem
setlocal enabledelayedexpansion
for /f "usebackq tokens=*" %%c in (`docker ps -f label^=fabric-environment-name^="<%= name %>" -q -a`) do (
for /f "usebackq tokens=*" %%c in (`docker ps -f label^=fabric-environment-name^="<%= name %> Microfab" -q -a`) do (
docker rm -f %%c
if !errorlevel! neq 0 (
exit /b !errorlevel!
)
)
for /f "usebackq tokens=*" %%v in (`docker volume ls -f label^=fabric-environment-name^="<%= name %>" -q`) do (
for /f "usebackq tokens=*" %%v in (`docker volume ls -f label^=fabric-environment-name^="<%= name %> Microfab" -q`) do (
docker volume rm -f %%v
if !errorlevel! neq 0 (
exit /b !errorlevel!
Expand Down
4 changes: 2 additions & 2 deletions generators/network/templates/teardown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
#
# Exit on first error, print all commands.
set -ev
for CONTAINER in $(docker ps -f label=fabric-environment-name="<%= name %>" -q -a); do
for CONTAINER in $(docker ps -f label=fabric-environment-name="<%= name %> Microfab" -q -a); do
docker rm -f ${CONTAINER}
done
for VOLUME in $(docker volume ls -f label=fabric-environment-name="<%= name %>" -q); do
for VOLUME in $(docker volume ls -f label=fabric-environment-name="<%= name %> Microfab" -q); do
docker volume rm -f ${VOLUME}
done
exit 0
20 changes: 10 additions & 10 deletions test/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ describe('Network', () => {
'teardown.cmd',
'teardown.sh'
]);
assert.fileContent('is_running.cmd', /docker ps -f label\^=fabric-environment-name\^="local_fabric" -q/);
assert.fileContent('is_running.sh', /docker ps -f label=fabric-environment-name="local_fabric" -q/);
assert.fileContent('is_running.cmd', /docker ps -f label\^=fabric-environment-name\^="local_fabric Microfab" -q/);
assert.fileContent('is_running.sh', /docker ps -f label=fabric-environment-name="local_fabric Microfab" -q/);
// assert.fileContent('kill_chaincode.sh', /docker stop localfabric-peer0.org1.example.com/);
// assert.fileContent('kill_chaincode.cmd', /docker stop localfabric-peer0.org1.example.com/);
assert.fileContent('start.cmd', /docker ps -f label\^=fabric-environment-name\^="local_fabric" -q -a/);
assert.fileContent('start.sh', /docker ps -f label=fabric-environment-name="local_fabric" -q -a/);
assert.fileContent('stop.cmd', /docker ps -f label\^=fabric-environment-name\^="local_fabric" -q/);
assert.fileContent('stop.sh', /docker ps -f label=fabric-environment-name="local_fabric" -q/);
assert.fileContent('teardown.cmd', /docker ps -f label\^=fabric-environment-name\^="local_fabric" -q -a/);
assert.fileContent('teardown.cmd', /docker volume ls -f label\^=fabric-environment-name\^="local_fabric" -q/);
assert.fileContent('teardown.sh', /docker ps -f label=fabric-environment-name="local_fabric" -q -a/);
assert.fileContent('teardown.sh', /docker volume ls -f label=fabric-environment-name="local_fabric" -q/);
assert.fileContent('start.cmd', /docker ps -f label\^=fabric-environment-name\^="local_fabric Microfab" -q -a/);
assert.fileContent('start.sh', /docker ps -f label=fabric-environment-name="local_fabric Microfab" -q -a/);
assert.fileContent('stop.cmd', /docker ps -f label\^=fabric-environment-name\^="local_fabric Microfab" -q/);
assert.fileContent('stop.sh', /docker ps -f label=fabric-environment-name="local_fabric Microfab" -q/);
assert.fileContent('teardown.cmd', /docker ps -f label\^=fabric-environment-name\^="local_fabric Microfab" -q -a/);
assert.fileContent('teardown.cmd', /docker volume ls -f label\^=fabric-environment-name\^="local_fabric Microfab" -q/);
assert.fileContent('teardown.sh', /docker ps -f label=fabric-environment-name="local_fabric Microfab" -q -a/);
assert.fileContent('teardown.sh', /docker volume ls -f label=fabric-environment-name="local_fabric Microfab" -q/);
}

it('should generate a one organization network using prompts into a test directory', async () => {
Expand Down

0 comments on commit 2b8f461

Please sign in to comment.