-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-6915] Fix chaincode startup issue in tests
This issue was caused by dangling chaincode images created with a different version of ccenv. This patch cleans up chaincode images and cleans up the docker-compose fixtures. Change-Id: I5caadf0bba6ba2bf120485030efef3098890b0b1 Signed-off-by: Troy Ronda <[email protected]>
- Loading branch information
Showing
6 changed files
with
138 additions
and
37 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
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
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
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
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
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,40 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright SecureKey Technologies Inc. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# | ||
|
||
DOCKER_CMD="${DOCKER_CMD:-docker}" | ||
DOCKER_COMPOSE_CMD="${DOCKER_COMPOSE_CMD:-docker-compose}" | ||
FIXTURE_PROJECT_NAME="${FIXTURE_PROJECT_NAME:-fabsdkgo}" | ||
DOCKER_REMOVE_FORCE="${DOCKER_REMOVE_FORCE:-false}" | ||
|
||
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
|
||
rm -f ${SCRIPT_PATH}/../fixtures/tls/fabricca/certs/server/ca.org*.example.com-cert.pem | ||
echo "Removing docker-compose network created from fixtures ..." | ||
COMPOSE_PROJECT_NAME=FIXTURE_PROJECT_NAME cd ${SCRIPT_PATH}/../fixtures && $DOCKER_COMPOSE_CMD -f docker-compose.yaml -f docker-compose-nopkcs11-test.yaml -f docker-compose-pkcs11-test.yaml down | ||
|
||
DOCKER_REMOVE_ARGS= | ||
if [ "$DOCKER_REMOVE_FORCE" = "true" ]; then | ||
DOCKER_REMOVE_ARGS="-f" | ||
fi | ||
|
||
CONTAINERS=$($DOCKER_CMD ps -a | grep "${FIXTURE_PROJECT_NAME}-peer.\.org.\.example\.com-" | awk '{print $1}') | ||
IMAGES=$($DOCKER_CMD images | grep "${FIXTURE_PROJECT_NAME}-peer.\.org.\.example\.com-" | awk '{print $1}') | ||
|
||
if [ ! -z "$CONTAINERS" ]; then | ||
if [ "$DOCKER_REMOVE_FORCE" = "true" ]; then | ||
echo "Stopping chaincode containers created from fixtures ..." | ||
$DOCKER_CMD stop $CONTAINERS | ||
fi | ||
|
||
echo "Removing chaincode containers created from fixtures ..." | ||
$DOCKER_CMD rm $DOCKER_REMOVE_ARGS $CONTAINERS | ||
fi | ||
|
||
if [ ! -z "$IMAGES" ]; then | ||
echo "Removing chaincode images created from fixtures ..." | ||
$DOCKER_CMD rmi $DOCKER_REMOVE_ARGS $IMAGES | ||
fi |